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

Introspector.decapitalize cause attribute not found exception when parameter name starts with two uppercase letters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.13.16 (Ingalls SR16)
    • Fix Version/s: None
    • Component/s: Mapping / Conversion
    • Labels:
      None
    • Environment:
      spring boot 1.5.17 release

      Description

      The commit https://github.com/spring-projects/spring-data-commons/commit/5f87c6766863072d761cb02f278b13c8631e655f#diff-b9260ff138b656777898127d2fe03f02 changes propertyName handling from StringUtils.uncapitalize(name) to Introspector.decapitalize(name), and it cause exception when the attribue name contain two uppercase letters at beginning.

      Example:

       

      public interface InebQuestionnaireQuestionRepository extends CrudRepository<InebQuestionnaireQuestionEntity, InebQuestionnaireQuestionEntityPk> {
          List<InebQuestionnaireQuestionEntity> findByTypeAndVCodeOrderByQCodeAsc(String type, String vCode);	
          List<InebQuestionnaireQuestionEntity> findByTypeAndVCodeAndStrategyCodeOrderByQCodeAsc(String type, String vCode, String strategyCode);
      }
      

      will cause exception:

      Caused by: java.lang.IllegalArgumentException: Attribute "QCode" of any not found in com.ctbc.ebmw.business.robogo.repository.entities.InebQuestionnaireQuestionEntity
      	at org.apache.openjpa.persistence.meta.AbstractManagedType.notFoundException(AbstractManagedType.java:741) ~[openjpa-2.4.2.jar:2.4.2]
      	at org.apache.openjpa.persistence.meta.AbstractManagedType.getAttribute(AbstractManagedType.java:244) ~[openjpa-2.4.2.jar:2.4.2]
      	at org.apache.openjpa.persistence.meta.AbstractManagedType.getAttribute(AbstractManagedType.java:468) ~[openjpa-2.4.2.jar:2.4.2]
      	at org.springframework.data.jpa.repository.query.QueryUtils.toExpressionRecursively(QueryUtils.java:571) ~[spring-data-jpa-1.11.16.RELEASE.jar:na]
      	at org.springframework.data.jpa.repository.query.QueryUtils.toJpaOrder(QueryUtils.java:548) ~[spring-data-jpa-1.11.16.RELEASE.jar:na]
      	at org.springframework.data.jpa.repository.query.QueryUtils.toOrders(QueryUtils.java:501) ~[spring-data-jpa-1.11.16.RELEASE.jar:na]
      	at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:195) ~[spring-data-jpa-1.11.16.RELEASE.jar:na]
      	at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:143) ~[spring-data-jpa-1.11.16.RELEASE.jar:na]
      	at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:52) ~[spring-data-jpa-1.11.16.RELEASE.jar:na]
      	at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:88) ~[spring-data-commons-1.13.16.RELEASE.jar:na]
      	at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:73) ~[spring-data-commons-1.13.16.RELEASE.jar:na]
      	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.<init>(PartTreeJpaQuery.java:133) ~[spring-data-jpa-1.11.16.RELEASE.jar:na]
      	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:72) ~[spring-data-jpa-1.11.16.RELEASE.jar:na]
      	... 52 common frames omitted

      The same code fragment works fine on spring boot 1.5.13.RELEASE (spring-data-commons-1.3.12.RELEASE)

       

       

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            horance horance
            Last updater:
            horance
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: