Skip to content

MutationSpecificationImpl#getResultType must return null (and not Void.class) #10083

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

Merged
merged 2 commits into from
Apr 25, 2025

Conversation

DavideD
Copy link
Member

@DavideD DavideD commented Apr 25, 2025

Fix https://hibernate.atlassian.net/browse/HHH-19386


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


Returning `Void.class` causes the validation in `QuerySqmImpl`
to fail with the error:
```
org.hibernate.query.IllegalQueryOperationException: Result type given for a non-SELECT Query [<criteria>]
```

when the query is executed like in the example:
```java
MutationSpecification  mutationSpecification  = MutationSpecification.create( ... )
session
   .createQuery(mutationSpecification.reference())
   .executeUpdate();
```
@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Apr 25, 2025

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

@DavideD DavideD force-pushed the HHH-19386-getResultType branch from 497a931 to b287863 Compare April 25, 2025 13:57
Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DavideD, appreciated.

Clearly I should have written that test myself (I knew at the time I should have), and then this would not have happened.

@gavinking gavinking merged commit 6dc2e7b into hibernate:main Apr 25, 2025
25 checks passed
@DavideD
Copy link
Member Author

DavideD commented Apr 26, 2025

Clearly I should have written that test myself (I knew at the time I should have), and then this would not have happened.

:) No problem. I've just noticed because in Hibernate Reactive we cannot use the regular .createQuery method from the class

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants