I'm new to Hibernate, and I can't find what i'm searching for. Here is what I want to do. I have a Adresse object which contains a array of long. I want to retrieve all Adresse objects that have at least one value (from a list a provide) in their long array. I'm searching for the HQL query to do this ...
So here is a example, in case I'm not clear enough.
Suppose we have 2 adresses object
Addr1 with longArray containing (1,2,3)
Addr2 with longArray containing (3,4,5,6)
A query could be "give my all adresses with a long array containing the value 1 or 4". In this case, Addr1 and Addr2 would be return. But if I ask for all addresses containing 1 or 2, only Addr1 would be return.
I already try something like
from Adresse where longArray in (1,4)
or
from Adresse where elements(longArray) in (1,4)
but no luck
Here is the mapping on my Adresse object :
Code:
<hibernate-mapping>
<class name="Adresse" table="adresse">
<id name="id" column="id_adresse">
<generator class="sequence">
<param name="sequence">adresse_id_adresse_seq</param>
</generator>
</id>
<version name="ts" type="timestamp"/>
<property name="ville"/>
<property name="province"/>
<property name="pays"/>
<array name="longArray" table="adresse_localisation" cascade="all">
<key column="adresse_id"/>
<list-index column="index" base="0"/>
<element type="long" column="localisation_id" />
</array>
</class>
</hibernate-mapping>