Я пытаюсь отобразить два объекта с помощью NHibernate
Это мой первый объект "Asociado", составленный "Justificaciones", рядом с ним "Justificacion", который имеет составной ключ
public class Justificacion
{
private int _id; //(PK)
private Asociado _asociado;(FK)
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public override string ToString()
{
return base.ToString();
}
public virtual int Id
{
get { return _id; }
set { _id = value; }
}
public virtual Asociado Asociado
{
get { return _asociado; }
set { _asociado = value; }
}
}
public class Asociado
{
private int _id;
private IList<Justificacion> _justificaciones;
public virtual int Id
{
get { return this._id; }
set { this._id = value; }
}
public virtual IList<Justificacion> Justificaciones
{
get { return _justificaciones; }
set { _justificaciones = value; }
}
}
это отображение, которое я сделал, но не работает
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="Trascend.Bolet.ObjetosComunes"
namespace="Trascend.Bolet.ObjetosComunes.Entidades">
<class name="Justificacion" table="FAC_ASO_JUST">
<composite-id>
<key-property name="Id" column="CCARTA" type="int"></key-property>
<key-property name="Asociado" column="CASOCIADO" type="int"></key-property>
</composite-id>
<many-to-one name="Asociado" class="Asociado">
<column name="CASOCIADO"/>
</many-to-one>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="Trascend.Bolet.ObjetosComunes"
namespace="Trascend.Bolet.ObjetosComunes.Entidades">
<class name="Asociado" table="FAC_ASOCIADOS">
<id name="Id" column="CASOCIADO" />
<bag name="Justificaciones"
fetch="join"
inverse="true"
cascade="save-update">
<key>
<column name="CCARTA"/>
<column name="CASOCIADO"/>
</key>
<one-to-many class="Justificacion"/>
</bag>
</hibernate-mapping>