Hql "in" statement does not work with @ElementCollection


I have a class collection property with @ElementCollection and @Enumerated(EnumType.ORDINAL)
I try to execute the in statement in this collection, however in the generated sql I get this -> {non-qualified-property-ref} in (?)

I can do something wrong by creating hql myself. Maybe because elements are actually enumeration values?

Thanks Peter

+4
source share
1 answer

You should do this using the expression "in elements", as per the documentation ( http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/queryhql.html ):

 select mother from Cat as mother, Cat as kit where kit in elements(foo.kittens) 

However, there is an open error in Hibernate ... this does not work, as you might expect for enumeration values, see: https://hibernate.onjira.com/browse/HHH-5159 for a workaround.

+1
source

Source: https://habr.com/ru/post/1380670/


All Articles