REST Data Panache with ResteasyReactive: field 'id' was not found error
See original GitHub issueDescribe the bug
When using REST Data Panache with ResteasyReactive for entity that has an id field not named “id” application crashes on start with exception:
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.resteasy.reactive.links.deployment.LinksProcessor#initializeLinksProvider threw an exception: java.lang.RuntimeException: Class 'java.lang.Object' field 'id' was not found
at io.quarkus.resteasy.reactive.links.deployment.LinksProcessor.getFieldInfo(LinksProcessor.java:146)
at io.quarkus.resteasy.reactive.links.deployment.LinksProcessor.getFieldInfo(LinksProcessor.java:144)
at io.quarkus.resteasy.reactive.links.deployment.LinksProcessor.getFieldInfo(LinksProcessor.java:144)
at io.quarkus.resteasy.reactive.links.deployment.LinksProcessor.implementPathParameterValueGetters(LinksProcessor.java:103)
at io.quarkus.resteasy.reactive.links.deployment.LinksProcessor.initializeLinksProvider(LinksProcessor.java:65
example entity:
public class ExampleEntity extends PanacheEntityBase {
@Id
long companyId;
}
example resource:
@ResourceProperties(path = "/example")
public interface ExampleResource extends PanacheEntityResource<ExampleEntity, Long> {
}
Data Panache generate resource with path “/example/{id}” so io.quarkus.resteasy.reactive.links.deployment.LinksProcessor#getFieldInfo
scans for field “id”, ignoring the fact that entity can have id field with whatever name but with annotation @Id
Expected behavior
REST Data Panache with ResteasyReactive should work with an entity with id field not named “id” but annotated with @Id
Actual behavior
No response
How to Reproduce?
use
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-rest-data-panache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
</dependency>
example entity:
public class ExampleEntity extends PanacheEntityBase {
@Id
long companyId;
}
example resource:
@ResourceProperties(path = "/example")
public interface ExampleResource extends PanacheEntityResource<ExampleEntity, Long> {
}
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
2.9.2.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
No response
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Writing REST Services with RESTEasy Reactive - Quarkus
When the result the userPublic method is serialized, the id field will not be contained in the response as the Public view does...
Read more >Errors after switching to quarkus-resteasy-reactive
The release notes for 2.8 tell me I should switch to quarkus-resteasy-reactive and it's a 1:1 replacment and no changes are necessary.
Read more >StackOverflowError when executing Hibernate Panache list ...
Hi Quarkus devs, I've stumbled upon a "RESTEASY008205: JSON Binding serialization error java.lang.StackOverflowError" when executing a REST GET backed by an ...
Read more >Data Persistence with Quarkus and Hibernate Panache
orm.panache.PanacheEntity : This is the simplest option as you will get an ID field that is auto-generated. Extending io.quarkus.hibernate.
Read more >Build a REST API from the ground up with Quarkus 2.0
Lombok is a Java library that helps keep the amount of boilerplate code in an application to a minimum; however, its use is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can you change the type of your id to
Long
instead of the primitive typelong
?By the way, this is the default ID field provided by
PanacheEntity
so you better usePanacheEntity
instead ofPanacheEntityBase
.https://github.com/quarkusio/quarkus/pull/25925 takes care of it