Hi All,
I have a problem, how to join Nhibernate criteria query with and
condition
this is my query
ICriteria Query = session.CreateCriteria(typeof(organization), "org")
.CreateCriteria("org.orgModuleMaps",
"orgmod", JoinType.InnerJoin).Add(Restrictions.Eq("orgmod.isActive",
true))
.CreateCriteria("orgmod.module",
"mod", JoinType.InnerJoin).Add(Restrictions.Eq("mod.isActive", true))
.CreateCriteria("org.userOrgMaps",
"usrorg", JoinType.InnerJoin).Add(Restrictions.Eq("usrorg.isActive",
true))
.CreateCriteria("usrorg.user",
"usr", JoinType.InnerJoin).Add(Restrictions.Eq("usr.isActive", true))
.CreateCriteria("usr.userRoleMaps",
"usrrm", JoinType.InnerJoin).Add(Restrictions.Eq("usrrm.isActive",
true))
.CreateCriteria("usrrm.userRole",
"usrr", JoinType.InnerJoin).Add(Restrictions.Eq("usrr.isActive",
true))
.CreateCriteria("permissions",
"perm", JoinType.InnerJoin);
here in permissions table i have two put join from organization table
also with orgId...I dont know how..........
this is the sql
exec sp_executesql N'SELECT * FROM Organization this_ inner join
OrgModuleMap orgmod1_ on
this_.OrgId=orgmod1_.OrgId inner join Module mod2_ on
orgmod1_.ModuleId=mod2_.ModuleId inner join UserOrgMap
usrorg3_ on this_.OrgId=usrorg3_.OrgId inner join Users usr4_ on
usrorg3_.UserId=usr4_.UserId inner join
UserRoleMap usrrm5_ on usr4_.UserId=usrrm5_.UserId inner join UserRole
usrr6_ on
usrrm5_.UserRoleId=usrr6_.UserRoleId inner join Permission perm7_ on
usrr6_.UserRoleId=perm7_.UserRoleId WHERE
orgmod1_.IsActive = @p0 and mod2_.IsActive = @p1 and usrorg3_.IsActive
= @p2 and usr4_.IsActive = @p3 and
usrrm5_.IsActive = @p4 and usrr6_.IsActive = @p5',N'@p0 bit,@p1
bit,@p2 bit,@p3 bit,@p4 bit,@p5
bit',@p0=1,@p1=1,@p2=1,@p3=1,@p4=1,@p5=1
Please help
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.