I have a problem querying an array of elements,
The mapping of the element is
<class name="Profiles" table="profiles">
.....
<array name="languages" cascade="all" table="profileLanguages">
<key column="profileId"/>
<index column="arrayIdx"/>
<element column="language" type="string"/>
</array>
....
</class>
Save, update, delete are OK.
I am using mysql( so it does not support subselects), so I tried the following query:
"from Profiles p join p.languages as plg where p.city like :city and plg.language in (:langs)"
and I got the following error:
cannot dereference scalar collection element
When I used the same approach to query based on a mapped class(instead of an element) and it worked.
It seems that when joining, collections of mapped classes and elements are treated differently
|