java - How to use Subqueries.in -



java - How to use Subqueries.in -

how express such hql query via criteria api?

select a (select b.prop b b b.id = a.parent) in ('1', '2', '3')

list of ids passed parameter.

here subquery:

detachedcriteria subquery = detachedcriteria.forclass(b.class, "b"). .add(restrictions.eqproperty("b.id", "a.parent")) .setprojection(projections.property("b.prop"));

subqueries.in , propertyin work opposite way (prop in subquery, not subquery in prop need). thoughts?

you can utilize restrictions.in(...).

list<integer> values=new arraylist<integer>(); values.add(1); values.add(2); values.add(3); detachedcriteria subquery = detachedcriteria.forclass(b.class, "b"). .add(restrictions.eqproperty("b.id", "a.parent")) .setprojection(projections.property("b.prop")). .add(restrictions.in("b.prop", values);

java hibernate hibernate-criteria

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -