Spring Data API Extension Interface Projections not working with generic interfaces
Describe the bug
When i have a repository like public interface ParentBaseRepository<T extends ParentBase<C>, C extends ChildBase> extends JpaRepository<T, Long> then the generic C causes the method List<T> findAllTestById(Long id); to throw java.lang.IllegalArgumentException: findAllTestById of Repository at.atc.database.repository.ParentRepository can only use interfaces to map results to non-entity types.. When you remove that function then the function GenericParent<C> findChildrenById(Long id); throws the same exception. Both should work.
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
I don't know if the code to save a parent with children in the reproducer works because i couldn't test it.
Reproducer: reproducerJPAInterfaceMapping.zip I just in case added the spring boot example: SpringBootJpaTestInterfaceMapping.zip
Output of uname -a or ver
No response
Output of java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version or gradlew --version)
No response
Additional information
No response
/cc @geoand (spring)
This is fixed by #34414
@geoand I tried my reproducer with 3.2.1 but it is not working.
@geoand
I retestet my reproducer with 3.15.1 and the following function in the ParentBaseRepository fails:
GenericParent<C> findChildrenById(Long id);
interface GenericParent<T extends ChildBase> {
List<T> getChildren();
}
The error message:
[error]: Build step io.quarkus.spring.data.deployment.SpringDataJPAProcessor#build threw an exception: java.lang.IllegalArgumentException: findChildrenById of Repository at.atc.database.repository.ParentRepository can only use interfaces to map results to non-entity types.
at io.quarkus.spring.data.deployment.generate.DerivedMethodsAdder.add(DerivedMethodsAdder.java:195)
at io.quarkus.spring.data.deployment.generate.SpringDataRepositoryCreator.implementCrudRepository(SpringDataRepositoryCreator.java:117)
at io.quarkus.spring.data.deployment.SpringDataJPAProcessor.implementCrudRepositories(SpringDataJPAProcessor.java:268)
at io.quarkus.spring.data.deployment.SpringDataJPAProcessor.build(SpringDataJPAProcessor.java:133)
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
Thanks for the update
cc @aureamunoz