c# - All items in list query with nHibernate -


i know there restriction "in" allows detect if 1 or more elements in property in target list need tell me if items property in target list. here's example:

i want person these competencies

competenciescriterion : ilist<competency>   { walking, running, rolling } 

between persona , personb:

persona : person   competencies : ilist<competency>     { walking }  personb : person   competencies : ilist<competency>     { walking, rolling, running } 

is there restriction or expression allow me execute search or know clean way instead of stacking "in" within "conjunction"?

thanks in advance,

Étienne brouillard

i found way result wanted. stacking "in" not working figured out using subquery , counting "in" produce criteria on can verify condition counts equal.

here's sample:

var competencysubquery = detachedcriteria.for<employee>("employee2"); competencysubquery.createalias("employee2.competencies", "employee2competencies"); competencysubquery.setprojection(projections.count(projections.property("employee2competencies.competency"))); competencysubquery.add(restrictions.in("employee2competencies.competency",     searchcriteria.competencies)); competencysubquery.add(restrictions.eqproperty("employee2.id", "employee.id")); criteriajunction.add(subqueries.eq(searchcriteria.competencies.count(), competencysubquery)); 

criteriajunction being criteria used in end findall , searchcriteria being poco containing criteria sent service.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -