Skip to content

Exception swallowed in CreateIfNotFoundQueryLookupStrategy.resolveQuery [DATAJPA-1723] #2018

Closed
@spring-projects-issues

Description

@spring-projects-issues

ckalan opened DATAJPA-1723 and commented

Exception thrown from lookupStrategy.resolveQuery() is swallowed without proper logging before falling back to createStrategy. 

In my case it occured when I used @Query annotation in my repo method with "name" attribute pointing to a JPA Named Query declared on the entity. The problem was I also used Sort parameter and I got "propert not found for type ..." exception. In fact the inner exception was thrown by "NamedQueries" class with this code:

throw new IllegalStateException(String.format("Finder method %s is backed " + "by a NamedQuery and must "
  + "not contain a sort parameter as we cannot modify the query! Use @Query instead!", method));

It took me a couple of hours to identify the issue and I had to deep dive in the code because there was no debug log for the actual error. In addition to the logs, it might be a good idea to update the docs to mention this limitation. 

Note that this happens in 2.2.6 RELEASE version that comes with Spring Boot but that version is not listed in the Affects Version/s field above.  

 


No further details from DATAJPA-1723

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions