-
Notifications
You must be signed in to change notification settings - Fork 1.5k
DTO Projection rewriting rewrites queries returning properties to DTO form #3862
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Github doesn't seem want to let me upload a sample project, so hopefully this link to the repo: |
Thanks a lot for exploring our release candidate. That is a regression introduced with DTO projection rewriting. We're now introspecting the query closer for projections and property paths. |
mp911de
added a commit
that referenced
this issue
May 5, 2025
…operties. We back off from rewriting String-based queries to use DTO Constructor expressions if the query selects a property that is assignable to the return type. Closes #3862
mp911de
added a commit
that referenced
this issue
May 13, 2025
…operties. We back off from rewriting String-based queries to use DTO Constructor expressions if the query selects a property that is assignable to the return type. Closes #3862
mp911de
added a commit
that referenced
this issue
May 15, 2025
…operties. We back off from rewriting String-based queries to use DTO Constructor expressions if the query selects a property that is assignable to the return type. Closes #3862
mp911de
added a commit
that referenced
this issue
May 16, 2025
…operties. We back off from rewriting String-based queries to use DTO Constructor expressions if the query selects a property that is assignable to the return type. Closes #3862
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
The 3.5.0 release line throws a org.hibernate.query.SyntaxException when a @query tries to return a property of an object which itself is a different entity. A basic example of the entity relationships and repository method are shown below. This code attached works as expected under 3.4.5, where the country property of the entity is returned for use.
If the query string is updated to
SELECT gcm.country FROM GroupCountryMapping gcm WHERE gcm.id=:grp
it appears that spring data/hibernate looks for a copy constructor rather than the typical no argument constructor.The text was updated successfully, but these errors were encountered: