I have an entity with a set, for example
Library---><Set>books
Now I want to get libraries in which ALL books have a genre.
So, I have something like this:
c.createCriteria("library", "library").createCriteria("books", "book"); c.add(Restrictions.isNotNull("book.genre"));
If I execute the request, I get libraries in which at least one book has a genre but I would like hibernate to check the genre property for all elements of the book set and return libraries where ALL elements satisfy a non-empty constraint.
Sorry for my English, I hope the problem is clear, any help is much appreciated.
Thanks.
hibernate criteria
Luca
source share