Hi,
Following from the hibernate examples, let's say I have a list of Cats each containing a list of kittens with the date they were born (column "born" on kittens table) and their name. Let's say I want to query all Cats that have a kitten where I want to check that only the last Kitten born has a name equals to "Mimi"
This is what I thought would work but doesn't:
Code:
Criteria c = session.createCriteria(Cats.class).createCriteria("kittens").
addOrder(Order.desc("date")).setMaxOrder(1).
add(Restrictions.eq("name", "Mimi"));
return c.list();
}
Any ideas are greatly appreciated!
Thanks, Jason[/code]