Hi guys, no matter what I do my child collection gets loaded. Please help.
Parent mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="mySchema">
<class name="Domain.Parent, Domain" table="PARENT" persister="Server.Persistence.NHibernateWrapper.DomainPersister, Server.Persistence.NHibernateWrapper">
<id name="Key" type="Guid" column="ParentKey">
<generator class="assigned"/>
</id>
<version name="Version" column="Version" type="Int32" unsaved-value="null" />
<property name="Name" column="Name" type="String"/>
<bag name="Children" lazy="true" access="Server.Persistence.NHibernateWrapper.Accessor, Server.Persistence.NHibernateWrapper">
<key column="ParentKey" />
<one-to-many class="Domain.Child, Domain" />
</bag>
</class>
</hibernate-mapping>
Child mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="mySchema">
<class name="Domain.Child, Domain" table="CHILD" lazy="true" persister="Server.Persistence.NHibernateWrapper.DomainPersister, Server.Persistence.NHibernateWrapper">
<id name="Key" type="Guid" column="ChildKey">
<generator class="assigned"/>
</id>
<version name="Version" column="Version" type="Int32" unsaved-value="null" />
<property name="Name" column="Name" type="String"/>
</class>
</hibernate-mapping>
Parent class:
Code:
namespace Domain
{
[Serializable()]
public class Parent : IDomain
{
private Guid key = new Guid();
private string name;
private int? version;
private DomainCollection<Child> children;
public Parent()
{ }
public string Name
{
get { return name; }
set { name = value; }
}
public virtual int? Version
{
get
{
return version;
}
set
{
version = value;
}
}
public virtual Guid Key
{
get
{
return key;
}
set
{
key = value;
}
}
public DomainCollection<Child> Children
{
get { return children; }
set { children = value; }
}
}
}
Child class:
Code:
namespace Paceart.Domain
{
[Serializable()]
public class Child : IDomain
{
private Guid key = new Guid();
private string name;
private int? version;
public Child()
{ }
public virtual string Name
{
get { return name; }
set { name = value; }
}
public virtual int? Version
{
get
{
return version;
}
set
{
version = value;
}
}
public virtual Guid Key
{
get
{
return key;
}
set
{
key = value;
}
}
}
}