-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird JSON output from Entity class with @ManyToOne field. #3408
Comments
@wargun02 could you put together a reproducer? It will be easier to debug. Thanks! |
@gsmet I'm new to this project. Could you suggest how I can put together a reproducer, as in do I start a GitHub project, upload it? or attached a zip file containing all the codes? |
As you prefer really. A GitHub project allows to discuss more easily I think but it's really no obligation. Just create an empty Quarkus project, add the class necessary to reproduce your issue and push it. |
I have changed the title to: "Weird JSON output from Entity class with @manytoone field." |
@wargun02 thanks for the reproducer! Here is the SQL that Hibernate is generating based on your query:
which seems to me that you are not executing the query you intended |
Changing the query in the repository class to:
with the "select gs from GeoStateEntity gs..." seems to work (instead of just "from GeoStateEntity gs..."). Anyway, I'm just following some example jpql from the documentation on Panache, thought I could save a few "keyboard typings". If this is not a bug and it is intended to work at such, please close this issue. |
But having the repository method returning "List< GeoStateEntity >", seems odd to me that the JSON output doesn't quite conform to what is in "GeoStateEntity". |
Yes, which is why I think (from the little I looked at it) that you are not really returning GeoStateEntity from the query (due the join). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you! |
Say if I have an Entity class GeoCountryEntity
and another entity class GeoStateEntity:
Do note the geoCountryEntity field below which is annotated @JsonbTransient
A simple PanacheRepository class:
A REST Resource class:
I get very weird results like:
Expected Result Should Be
Environment:
Quarkus Version: 0.19.1
Java Version: openjdk version "11.0.4" 2019-07-16 LTS
OpenJDK Runtime Environment Zulu11.33+15-CA (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Zulu11.33+15-CA (build 11.0.4+11-LTS, mixed mode)
The text was updated successfully, but these errors were encountered: