left outer join in nhibernate
like.....
vehicle table
id vehicle_id vehicle_Name
1 TN10001 car 2 TN100 bus 3 tn4oo vandevice table
id device_ID .... Vehicle_id
1 d1... 1 2 d2 ... nulli want vehicleid's(tn100,tn4oo) from vehicle table which r not in device table( have vehicle id Tn10001 )
where bi directional one to many mapping i开发者_StackOverflow社区s mapped in vehicle.
This should do the trick
var invalidVehicleIds= DetachedCriteria.For(typeof(Device))
.SetProjection(Projections.Id());
Session.CreateCriteria(typeof(Vehicle))
.Add(Subqueries.PropertyNotIn("Id",invalidVehicleIds))
.List<Vehicle>()
精彩评论