Is there any way to logging to turn up for troubleshooting why an object wouldn't have been hydrated? Making the exact same call at two different points is yielding different results in terms of object hydration:
Call 1 – Able to hydrate a bar object when opening an foo
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.Int64Type) 46 -> [0]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.Int64Type) 65535 -> [1]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.Int64Type) 46 -> [2]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.Int64Type) 46 -> [3]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.StringType) Foo 2009 -> [4]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.StringType) 555123 -> [5]
NHibernate.Loader.Loader - SELECT this_.Id as Id12_2_, this_.ClientId as ClientId12_2_, this_.ScheduleId as ScheduleId12_2_, this_.barId as barId12_2_, schedule1_.Id as Id13_0_, schedule1_.ClientId as ClientId13_0_, schedule1_.Name as Name13_0_, bar2_.Resource_Id as Resource1_4_1_, bar2_.Client_Id as Client7_4_1_, bar2_.User_Id as User8_4_1_, bar2_.bar_Id as bar9_4_1_, bar2_.bar_Name as bar10_4_1_, FROM foos this_ inner join fooSchedules schedule1_ on this_.ScheduleId=schedule1_.Id inner join VSec_User_bar_Info bar2_ on this_.barId=bar2_.bar_Id and (bar2_.Client_Id = :p0 OR bar2_.Client_Id IS NULL) and bar2_.User_Id = :p1 WHERE (schedule1_.ClientId = :p2 OR schedule1_.ClientId IS NULL) and (this_.ClientId = :p3 OR this_.ClientId IS NULL) AND schedule1_.Name = :p4 and bar2_.bar_Id = :p5
NHibernate.Loader.Loader - processing result set
NHibernate.Loader.Loader - result set row: 0
NHibernate.Loader.Loader - result row: EntityKey[Core.Domain.fooSchedule#2390744], EntityKey[Core.Domain.bar#18641357], EntityKey[Core.Domain.foo#3217256]
NHibernate.Loader.Loader - Initializing object from DataReader: [Core.Domain.fooSchedule#2390744]
NHibernate.Loader.Loader - Initializing object from DataReader: [Core.Domain.bar#18641357]
NHibernate.Loader.Loader - Initializing object from DataReader: [Core.Domain.foo#3217256]
NHibernate.Loader.Loader - done processing result set (1 rows)
NHibernate.Loader.Loader - total objects hydrated: 3
Call 2 – Not able to hydrate a bar object when copying a bar item which opens an foo
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.Int64Type) 5 -> [0]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.Int64Type) 65535 -> [1]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.Int64Type) 5 -> [2]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.Int64Type) 5 -> [3]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.StringType) Foo 2010 -> [4]
NHibernate.Engine.QueryParameters - BindParameters(Named:NHibernate.Type.StringType) 333222 -> [5]
NHibernate.Loader.Loader - SELECT this_.Id as Id12_2_, this_.ClientId as ClientId12_2_, this_.ScheduleId as ScheduleId12_2_, this_.barId as barId12_2_, schedule1_.Id as Id13_0_, schedule1_.ClientId as ClientId13_0_, schedule1_.Name as Name13_0_, bar2_.Resource_Id as Resource1_4_1_, bar2_.Client_Id as Client7_4_1_, bar2_.User_Id as User8_4_1_, bar2_.bar_Id as bar9_4_1_, bar2_.bar_Name as bar10_4_1_, FROM foos this_ inner join fooSchedules schedule1_ on this_.ScheduleId=schedule1_.Id inner join VSec_User_bar_Info bar2_ on this_.barId=bar2_.bar_Id and (bar2_.Client_Id = :p0 OR bar2_.Client_Id IS NULL) and bar2_.User_Id = :p1 WHERE (schedule1_.ClientId = :p2 OR schedule1_.ClientId IS NULL) and (this_.ClientId = :p3 OR this_.ClientId IS NULL) AND schedule1_.Name = :p4 and bar2_.bar_Id = :p5
NHibernate.Loader.Loader - processing result set
NHibernate.Loader.Loader - result set row: 0
NHibernate.Loader.Loader - result row: EntityKey[Core.Domain.fooSchedule#2929992], EntityKey[Core.Domain.bar#470090], EntityKey[Core.Domain.foo#3211664]
NHibernate.Loader.Loader - Initializing object from DataReader: [Core.Domain.fooSchedule#2929992]
NHibernate.Loader.Loader - Initializing object from DataReader: [Core.Domain.foo#3211664]
NHibernate.Loader.Loader - done processing result set (1 rows)
NHibernate.Loader.Loader - total objects hydrated: 2
The first call correctly hydrates 3 objects, while the second call hydrates only 2. Looking at the returned data I can't figure out why the second call won't hydrate Bar.