Help with NHibernate query -
i have 2 tables, plan , ticket. want records in travelplan not in ticket.
template.criteria.createcriteria("plan") .add(subqueries.propertynotin("userid", detachedcriteria.for(typeof(ticket)) .setprojection(projections.property("uid")))); the above query doesnt return records..
i can't guess searchtemplate does, applying projection outer criteria instead of detached one.
also, "root" criteria should travelplan, not ticket.
in other words:
criteria = detachedcriteria.for<travelplan>() .add(subqueries.propertynotin( "userid", detachedcriteria.for<ticket>() .setprojection(projections.property("uid")))) this assumes travelplan has userid property matches uid property in ticket.
Comments
Post a Comment