Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introspector.decapitalize cause attribute not found exception when parameter name starts with two uppercase letters [DATACMNS-1417] #1851

Open
spring-projects-issues opened this issue Nov 5, 2018 · 1 comment
Assignees
Labels
in: mapping type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Nov 5, 2018

horance opened DATACMNS-1417 and commented

The commit 5f87c67#diff-b9260ff138b656777898127d2fe03f02%C2%A0changes 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)

 

 


Affects: 1.13.16 (Ingalls SR16)

Reference URL: 5f87c67#diff-b9260ff138b656777898127d2fe03f02

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Nov 5, 2018

horance commented

The attribue in entity class is :

 

@Id
@Column(name = "Q_CODE")
private String qCode;

@spring-projects-issues spring-projects-issues added type: bug in: mapping labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: mapping type: bug
Projects
None yet
Development

No branches or pull requests

2 participants