From section 11.8 of the documentation:
Quote:
Elements of indexed collections (arrays, lists, maps) may be referred to by index (in a where clause only):
from Order order where order.Items[0].id = 1234
select person from Person person, Calendar calendar
where calendar.Holidays['national day'] = person.BirthDay
and person.Nationality.Calendar = calendar
select item from Item item, Order order
where order.Items[ order.DeliveredItemIndices[0] ] = item and order.id = 11
select item from Item item, Order order
where order.Items[ maxindex(order.items) ] = item and order.id = 11
The expression inside [] may even be an arithmetic expression.
select item from Item item, Order order
where order.Items[ size(order.Items) - 1 ] = item
HQL also provides the built-in index() function, for elements of a one-to-many association or collection of values.
select item, index(item) from Order order
join order.Items item
where index(item) < 5
I'm not aware of whether or not this is available in ICriteria but I doubt it.
Cheers,
Symon.