I have a list of IUser objects which are MTM related with IRole objects. These IRole objects in turn are MTM related to IPrivilege objects.
When retrieving an IUser object I can see all related IRole objects in the (IList) list of this IUser.
When retrieving an IRole object I can see all related IPrivilege objects in the (IList) list of this IRole.
But when I fetch a user and get inspect one role from that users role list the list of privileges in that role object is empty (the list is correctly initialized when fetching the role directly).
It looks like NHibernate is not fetching related objects of related objects in my setup. What am I doing wrong? How can I make NHibernate fully initialize all the role objects in the users list of roles so that each role shows a list of associated privileges?
BTW: Attention! I'm a NHibernate rookie!
Edit (@Firo):
These are the relation mapping fragments from IUser and IRole:
(IUser)
...
HasManyToMany<HbnRole>(x => x.Roles).Table("USERROLEMAP")
.ParentKeyColumn("USERID")
.ChildKeyColumn("ROLEID")
.Cascade.All();
(IRole)
...
HasManyToMany<HbnPrivilege>(x => x.Privileges).Table("ROLEPRIVILEGEMAP")
.ParentKeyColumn("ROLEID")
.ChildKeyColumn("PRIVILEGEID")
.Cascade.All();
HasManyToMany<HbnUser>(x => x.Users).Table("USERROLEMAP")
.Inverse()
.LazyLoad()
.ParentKeyColumn("ROLEID")
.ChildKeyColumn("USERID");
(IPrivilege)
...
HasManyToMany<HbnRole>(x => x.Roles).Table("ROLEPRIVILEGEMAP")
.Inverse()
.LazyLoad()
.ParentKeyColumn("PRIVILEGEID")
.ChildKeyColumn("ROLEID");
To be honest, I have no idea how to capture the query... :-(