I have two tables:
Customer and
License. The tables are joined by the table
Customer_License.
I have created a mapping for both the Customer and the License Class. The mappings are working fine.
I want to join both classes using the Customer License table.
The Customer Class:
Code:
public class Customer
{
private int customerId;
private string company;
private List<Person> contactPerson;
private License license;
public int CustomerId
{
get { return customerId; }
set { customerId = value; }
}
public string Company
{
get { return company; }
set { company = value; }
}
public List<Person> ContactPerson
{
get
{
List<Person> contactPersonList = new List<Person>();
foreach (Person untypedSetting in this.UntypedPerson)
{
contactPersonList.Add(untypedSetting);
}
return contactPersonList;
}
set { contactPerson = value; }
}
public License License
{
get { return license; }
set { license = value; }
}
#region nhibernate
protected IList personUntyped = new ArrayList();
/// <summary>
/// Collection of all values including expired and future values.
/// </summary>
public IList<Person> UntypedPerson
{
get { return new ListWrapper<Person>(personUntyped); }
}
/// <summary>
/// Untyped version of the Settings property for NHibernate compatibility
/// </summary>
private IList PersonUntyped
{
get { return personUntyped; }
set { personUntyped = value; }
}
#endregion
}
the Customor mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="prosys">
<class name="Wervis.Send2SMS.Business.Customer, Wervis.Send2SMS.Business" table="GL_Customer">
<id name="CustomerId" type="Int32" column="CustomerId">
<generator class="identity" />
</id>
<join table="GL_Customer_license">
<key column="CustomerId" unique="false" />
<many-to-one name="License" column="LicenseId" not-null="true" unique="true" class="Wervis.Send2SMS.Business.License, Wervis.Send2SMS.Business" />
</join>
<property name="Company" column="Company" type="String" />
<bag name="PersonUntyped" table="S2_Customer_Person">
<key column="CustomerId"/>
<many-to-many class="Wervis.Send2SMS.Business.Person, Wervis.Send2SMS.Business" column="PersonId"/>
</bag>
</class>
</hibernate-mapping>
When i test the mapping i get the following error:
Quote:
The element 'class' in namespace 'urn:nhibernate-mapping-2.0' has invalid child element 'join'
Does anybody now what i am doing wrong?