I've just updated from 0.6 to 0.84 and am having trouble with a simple set mapping. There are records in the database but when I try and interate through the collection there's nothing there. This worked fine in 0.6.
Code:
<set name="Facilities" lazy="true" inverse="true" cascade="all">
<key column="PRACTICE_ID" />
<one-to-many class="PLI.Model.Data.PracticeFacility, Model" />
</set>
Code:
Practice prac = (Practice)session.Get(typeof(Practice), 3);
System.Console.WriteLine(prac.Name);
System.Console.WriteLine("Facility count: ", prac.Facilities.Count.ToString());
for (IEnumerator en = prac.Facilities.GetEnumerator(); en.MoveNext(); )
{
System.Console.WriteLine((PracticeFacility)en.Current);
}
the log wrote:
2005-05-31 13:56:08,163 [3164] INFO NHibernate.Impl.SessionImpl [] - uninitialized collection: in
itializing
2005-05-31 13:56:09,746 [3164] INFO NHibernate.Impl.SessionImpl [] - new collection: instantiating
2005-05-31 13:56:09,776 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,776 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,776 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,786 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,786 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,786 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,796 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,796 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,796 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,796 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,806 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,806 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,806 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,806 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,816 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,816 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,816 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
2005-05-31 13:56:09,826 [3164] INFO NHibernate.Impl.SessionImpl [] - reading row
Facility count:
As you can see it's reading records from the database, but they don't end up in the collection!
Also, an HQL query of "select elements(p.Facilities) from PLI.Model.Data.Practice p where p.PracticeID = :practiceID" yields the expected results, a list of objects.
Since this worked previously in 0.6 and the HQL works I'm confident the mapping is correct. I've got other places with mappings/code that's almost identical and they work. Anyone run into this or have any ideas?
Thanks,
Michael