How can a report query be written that includes a array of primitives?
The mapping is :
<class name="Profile" table="Profile">
<id name="id" type="int">
<generator class="native" />
</id>
<property name="dept" type="string"/>
<property name="modified" type="timestamp" />
<primitive-array name="types" table="ProfileTypes" >
<key column="profileId"/>
<index column="ordinal"/>
<element column="type" type ="int"/>
</primitive-array>
...
</class>
A query like
"select p.id, elements(p.types) from Profile p where p.dept = ? order by p.id"
does return rows of id and type, but does not insure that the types are ordered by their index.
Would it help to rework the primitive-array as a List? It there a trick I am overlooking in the HQL?
|