Hibernate version: 1.2 beta 2 from svn
Database version: SQL Server 2005 (I use SQL2005Dialect)
Mapping documents: Here they are a bit simplified
Code:
<joined-subclass name="SmartBC.Entities.AddressBook.Person, SmartBC.Entities" table="Persons"
extends="SmartBC.Entities.BusinessEntity, SmartBC.Entities">
<key column="ID"/>
<set name="Organizations" lazy="true" inverse="true">
<key column="Organization" foreign-key="" />
<one-to-many class="SmartBC.Entities.AddressBook.PersonOfOrganization, SmartBC.Entities"/>
</set>
</joined-subclass>
<joined-subclass name="SmartBC.Entities.AddressBook.PersonOfOrganization, SmartBC.Entities" table="PersonsOfOrganization"
extends="SmartBC.Entities.DomainObject, SmartBC.Entities">
<key column="ID"/>
<property name="PersonRole" type="Int32" column="Role" />
<many-to-one name="Person" class="SmartBC.Entities.AddressBook.Person, SmartBC.Entities" column="Person" not-null="true" />
<many-to-one name="Organization" class="SmartBC.Entities.AddressBook.Organization, SmartBC.Entities" column="Organization" not-null="true" />
</joined-subclass>
<joined-subclass name="SmartBC.Entities.AddressBook.Organization, SmartBC.Entities" table="Organizations"
extends="SmartBC.Entities.BusinessEntity, SmartBC.Entities">
<key column="ID"/>
<set name="Persons" lazy="true" inverse="true">
<key column="Person" />
<one-to-many class="SmartBC.Entities.AddressBook.PersonOfOrganization, SmartBC.Entities" />
</set>
</joined-subclass>
So, the trouble is, that I can get correct PersonOfOrganization objects list with "from PersonOfOrganization", but Person.Organizations.Count is always zero, i.e. collections are not loaded. What I'm missing? *scratches head*