Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate Criteria for elements inside a Set

I have one entity that contains a set of another entity.

Entity1 contains Set entityTwos

I want to create a search criteria for an "id" field inside entityTwos.

I searched, but didn't get any answers. Anybody have an idea?

Thanks, Sri

like image 483
Sri Avatar asked May 31 '10 07:05

Sri


1 Answers

It was easy. Something like:

criteria.createAlias("entityTwos", "entityTwo");
criteria.add(Restrictions.eq("entityTwo.id", ...));
like image 192
Sri Avatar answered Nov 10 '22 22:11

Sri