Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1570

Parsing of query method names is inconsistent for attributes beginning with a single lower case character followed by an upper case character

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows 7

      Description

      My JPA Repository Method Query cannot parse a property name that comes after the OrderBy, but it can if it follows the findBy or findAllBy. The attribute in my entity that is giving me issues is zIndex

      Entity Class

       

      @Entity
       public class DisplayLayer 
       {
       @Id
       @Column(name="DISPLAY_LAYER_ID")
       private Long id;
       
       @ManyToOne(cascade = CascadeType.ALL)
       @JoinColumn(name="DISPLAY_CONTAINER_ID")
       private DisplayContainer displayContainer;
       
       @Column(name="NAME")
       private String name;
       
       @Column(name="Z_INDEX")
       private Long zIndex;
       
       @Column(name="DESCRIPTION")
       private String description;
      // Getters & Setters
       }
      

       

      Repository Class

       

      public interface DisplayLayerRepository extends BaseRepository<DisplayLayer, Long>
       {
       // This one method query works just fine
       public List<DisplayLayer> findByZIndex(Long pZIndex);
       // These two throw the same error:
       // Unable to locate Attribute with the the given name [ZIndex]
       //
       // public List<DisplayLayer> findAllByOrderByZIndexAsc();
       // public List<DisplayLayer> findByDisplayContainerIdOrderByZIndexAsc(Long pDisplayLayerId);
       }
      

       

      So in my first method query, when OrderBy is not used, it correctly parses it as [zIndex], but when it follows the OrderBy for some reason it capitalizes the z: [ZIndex].

      What makes me think there might be a bug with the parser is that if I update zIndex to IndexZ in my entity and then change my query methods from OrderByZIndex to OrderByIndexZ everything works.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              schauder Jens Schauder
              Reporter:
              gitflip GitFlip
              Last updater:
              Jens Schauder
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: