Hallo JBosseur,
i tried your code but it is not working.
The first problem is, that Restrictions.in() has only a constructor
for two parameters, one is a collection and the other the property name.
So i changed your code to:
Code:
List l = session.createCriteria(Physician.class, "ph")
.createCriteria("specialities")
.add(Restrictions.in("ph.specialities",specialities ))
.list();
Running this code throws a SQLException: ORA-01008 Not all variables bound.
The generated sql looks really strange (physician_specialities is my association-table):
Code:
select * from ( select this_.physician_id as physician1_0_1_, specialiti3_.physician_id as physician1_, speciality1_.speciality_id as speciality2_, speciality1_.speciality_id as speciality1_5_0_, speciality1_.speciality_code as speciality2_5_0_, speciality1_.name as name5_0_ from physician this_ inner join physician_specialities specialiti3_ on this_.physician_id=specialiti3_.physician_id inner join speciality speciality1_ on specialiti3_.speciality_id=speciality1_.speciality_id where 1=1 and this_.physician_id in (?) ) where rownum <= ?