Skip to content

Conversation

@peter1123581321
Copy link
Contributor

@peter1123581321 peter1123581321 commented May 28, 2025

When using @JavaType in an @Embeddable annotaded class, a NPE occurs when the field is used as a query parameter.
The AbstractSqlAstTranslator evaluates getSqlTuple(comparisonPredicate.getRightHandExpression()) to null when a SqmParameterInterpretation with a JdbcParameterImpl is given.
Adding a null check resolves the problem.

The bug ticket only describes the NPE in visitRelationalPredicate, but the same problem occurs in visitInListPredicate, so I added a fix for this too in this pull request.
I would expect, that there are even more of similar queries where this can happen.

Further note: the bug was reported using a custom @JavaType but the NPE is also thrown with native ones.


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.


https://hibernate.atlassian.net/browse/HHH-18898

@beikov beikov merged commit f90e97e into hibernate:main Jun 30, 2025
22 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants