How to resolve id to entity #169
PrimevalCoder
started this conversation in
General
Replies: 1 comment
-
One quick note: Jackson has no knowledge of anything Quarkus does, fwtw, so injecting things from outside does not work (and cannot work). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I'm working on a project where we use Quarkus. We have a couple entities with relationships between them, and they are exposed directly in the endpoints. The problem is, I need to somehow get Jackson to deserialize a field that is of reference type to another entity, but passed around in the JSON simply as an ID. For example purposes, let's say we have User and Address, two different entities, and User has a reference to address, like so:
The issue is, in the resolver I would need access to an @ApplicationScoped repository bean to retrieve the entity from the database, and it fails due to a NullPointerException. I've gone through some StackOverflow questions like this one, but unfortunately those only apply to Spring.
Any help would be extremely appreciated, thank you.
Beta Was this translation helpful? Give feedback.
All reactions