Florian Hof (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=6411c30...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiM2NlNGExYmJm...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16312?atlOrigin=eyJpIjoiM2NlNG...
) HHH-16312 (
https://hibernate.atlassian.net/browse/HHH-16312?atlOrigin=eyJpIjoiM2NlNG...
) function with collection makes NullPointerException (
https://hibernate.atlassian.net/browse/HHH-16312?atlOrigin=eyJpIjoiM2NlNG...
)
Issue Type: Bug Affects Versions: 6.1.7 Assignee: Unassigned Components: query-criteria
Created: 15/Mar/2023 06:26 AM Priority: Major Reporter: Florian Hof (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=6411c30...
)
With criteria builder, I’m calling a function which has a collection as parameter. This
fails with a NullPointerException when hibernate validates the types.
My code (simplified), where I define a generic “contains in array” check.
protected <T> Predicate contains(Expression<Collection<T>> array,
Expression<T> value) {
return criteriaBuilder.equal(value, criteriaBuilder.function("ANY",
Object.class, array));
}
This fails at ArgumentTypesValidator.validate:92 with a NullPointerException :
final JdbcType jdbcType = getJdbcType( queryEngine, argument, indicators, javaType ); // →
null
jdbcType.getDefaultSqlTypeCode() → NullPointerException
The ArgumentTypesValidator.getJdbcType:139 calls javaType.getRecommendedJdbcType and
CollectionJavaType.getRecommendedJdbcType always returns null. I think that
ArgumentTypesValidator.validate should handle a null jdbcType properly, in that case not
doing the validation.
Or what is your opinion? Is there a workaround?
(
https://hibernate.atlassian.net/browse/HHH-16312#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16312#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100217- sha1:fd7c927 )