How can I put thePosDisjunction in ON expression using Criteria in Hibernate?
Using: Criteria crit = getSession().createCriteria(SomeEntity.class); Criteria theSubCrit = crit.createCriteria("position", "pos", Criteria.LEFT_JOIN);
Disjunction thePosDisjunction = Expression.disjunction(); thePosDisjunction.add(Expression.eq("pos.status", (short)0)); thePosDisjunction.add(Expression.eq("pos.status", (short)3));
theSubCrit.add(thePosDisjunction); crit.list();
we got: select * from TABLE1 this_ left outer join TABLE2 pos1_ ON this_.PROP1=pos1_.PROP1 where (pos1_.status=? or pos1_.status=?)
How we can get next : select * from TABLE1 this_ left outer join TABLE2 pos1_ ON this_.PROP1=pos1_.PROP1 and (pos1_.status=? or pos1_.status=?)
Please help me. Sorry for my English.
|