Hibernate 6.4 - Parameter 0 of function 'array_position()' requires an array type, but argument is of type 'java.util.Collection'
dirkluijk opened this issue · 1 comments
dirkluijk commented
Describe the bug
After upgrading from Hibernate 6.2 to Hibernate 6.4, I'm getting the following error:
Parameter 0 of function 'array_position()' requires an array type, but argument is of type 'java.util.Collection'
When using:
cb.function("array_position", Integer::class.java, path, cb.literal(value))
Where the path references a ListArray
type:
@Type(ListArrayType::class)
val eans: List<String> = emptyList()
Using Spring Boot 3.2 with Kotlin.
I will see if I can isolate the issue to reproduce it.
dirkluijk commented
Triggered by this reply #685 (comment)
I was not aware that Hibernate 6 added support for array types, and more specifically, Hibernate 6.4 added support for some query functions: https://in.relation.to/2023/10/26/orm-64cr1/
I fixed this by removing the hypersistence library, and changing it to:
cb.greaterThan(function("array_position", Int::class.java, path, literal(value)), literal(0))
That means we can finally adopt the built-in support of Hibernate for this. Many thanks for this awesome library :)