hi peavish,
peavish wrote:
Try the following criteria query:
Code:
criteria.createAlias("MovieCategory", "mc");
criteria.add(Restrictions.in("mc.movieCategoryId", movieIds));
I have tried something similar to your above example, but with an group by projection on the criteria. The solution would work if it was possible to add a "having" clause to the criteria... I only need movies where ALL categories in the list is represented. With 3.0.5 there dosn't seem be a way to add a "having" clause.
The solution I ended up with is a dynamic build HQL where I insert all the relevant values and also using the "having" clause.
regards Claus