quarkus: Spring Data API Extension not working with Interface-based Projections
Describe the bug
I want to use a Interface-based Projection in my repository. But when i try to compile it get the following error that the methods don’t exist in the class. Even though they exist. In Spring this works as expected. Also when i ave multiple levels of generic repository interfaces and the generic type extends a base Class it also throws an exception. I added a comment in the reproducer how to create the error, it is in the interface ItemBaseRepository.
2023-03-10 21:47:19,719 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.spring.data.deployment.SpringDataJPAProcessor#build threw an exception: java.lang.IllegalArgumentException: getSymbolicImage method does not exists in at.atc.database.entities.Item class.
at io.quarkus.spring.data.deployment.generate.DerivedMethodsAdder.generateCustomResultTypes(DerivedMethodsAdder.java:348)
at io.quarkus.spring.data.deployment.generate.DerivedMethodsAdder.add(DerivedMethodsAdder.java:285)
at io.quarkus.spring.data.deployment.generate.SpringDataRepositoryCreator.implementCrudRepository(SpringDataRepositoryCreator.java:117)
at io.quarkus.spring.data.deployment.SpringDataJPAProcessor.implementCrudRepositories(SpringDataJPAProcessor.java:264)
at io.quarkus.spring.data.deployment.SpringDataJPAProcessor.build(SpringDataJPAProcessor.java:129)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:1589)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:335)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:86)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:447)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:59)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:149)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:104)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Expected behavior
I think right now the extension might only be picking up the functions from the first class, not inluding those from its super classes.
Actual behavior
No response
How to Reproduce?
QuarkusSpringDataInterfaceBasedProjections.zip
Output of uname -a or ver
No response
Output of java -version
Java version: 17.0.1
GraalVM version (if different from Java)
No response
Quarkus version or git rev
3.0.0.Aplha5
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Java version: 17.0.1, vendor: Oracle Corporation Default locale: de_AT, platform encoding: windows-1252 OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”
Additional information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (11 by maintainers)
Commits related to this issue
- Handle generic return type in Spring Data JPA repositories Fixes: #31774 — committed to geoand/quarkus by geoand a year ago
- Merge pull request #31810 from geoand/#31774 Handle generic return type in Spring Data JPA repositories — committed to quarkusio/quarkus by geoand a year ago
- Handle generic return type in Spring Data JPA repositories Fixes: #31774 — committed to karaelf33/quarkus by geoand a year ago
- Handle generic return type in Spring Data JPA repositories Fixes: #31774 — committed to karaelf33/quarkus by geoand a year ago
- Properly support extracting fields from entities into projections Fixes: #31774 — committed to geoand/quarkus by geoand a year ago
- Merge pull request #33265 from geoand/#31774 Properly support extracting fields from entities into projections — committed to quarkusio/quarkus by geoand a year ago
- Properly support extracting fields from entities into projections Fixes: #31774 — committed to michelle-purcell/quarkus by geoand a year ago
- Properly support extracting fields from entities into projections Fixes: #31774 — committed to michelle-purcell/quarkus by geoand a year ago
- Properly support extracting fields from entities into projections Fixes: #31774 — committed to manofthepeace/quarkus by geoand a year ago
- Properly support extracting fields from entities into projections Fixes: #31774 (cherry picked from commit 10ae12a0d8e5d169177b8263bbd315dad374e9c3) — committed to gsmet/quarkus by geoand a year ago
Sure
https://github.com/quarkusio/quarkus/pull/33265 fixes the issue