Hi,
I have a type that has a collection of strings, which is nice and
simple, and should really be quite simple to query - unfortunately I
can't work it out.
My type is mapped like this:
<subclass name="TeamLeader">
<property name="IsAdministrator" />
<set name="_TeamMembers" access="field">
<key column="TeamLeader" />
<one-to-many class="Engineer" />
</set>
<set name="_Regions" access="field" table="TeamLeaderRegions">
<key column="TeamLeader" />
<element column="RegionName" type="String" />
</set>
</subclass>
I don't think the parent class is affecting this problem at all.
Basically, I want to write a simple query that can query over the
regions collection for all TeamLeader objects returning the distinct
values in alphabetical order.
I've already given up on the criteria interface, but a solution using
criteria would be good.
In terms of HQL, I've arrived at this:
select distinct elements(t._Regions) from TeamLeader t
Which returns a list of distinct strings, nice and simple - the
question is, how do I add an order by clause - there doesn't appear to
be any identifier that I can use to order the list, I can't add an
alias for "elements(t._Regions)" and I can't add "order by
elements(t._Regions)".
It also appears that although I have a column name "RegionName", that
plays no part whatsoever in HQL, am I missing a simple intrinsic
function that can access the single unnamed string item in the
collection?
Any help with this would be very helpful.
Cheers,
Mark
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.