domingo, 9 de noviembre de 2008

could not resolve property: Id_Per

En NHibernate lo que manda a grandes rasgos es el maping y si ocurre este error es probable que la propiedad por la que ocurre el error no esta en el mapping, por ejemplo:

En el archivo con error falta la propiedad Id_Per.

Archivo con error:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="crmos.Bo.Contacto, crmos.Bo" table="Contacto">
<id name="Id_Con" type="Int32" unsaved-value="null">
<column name="Id_Con" length="4" sql-type="int" not-null="true" unique="true" index="PK_Contacto"/>
<generator class="native" />
</id>
<property name="Id_Cti" type="Int32">
<column name="Id_Cti" length="4" sql-type="int" not-null="false"/>
</property>
<property name="Fecha_Con" type="DateTime" access="property" >
<column name="Fecha_Con" sql-type="datetime" />
</property>
<property name="Observacion_Con" type="String" access="property">
<column name="Observacion_Con" length="16" sql-type="text" not-null="false"/>
</property>
<property name="Estado_Est" type="Int32" access="property">
<column name="Estado_Est" length="4" sql-type="int" not-null="false"/>
</property>
<property name="Id_Ven" type="Int32" access="property">
<column name="Id_Ven" length="4" sql-type="int" not-null="false"/>
</property>

</class>
</hibernate-mapping>

Archivo correcto
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="crmos.Bo.Contacto, crmos.Bo" table="Contacto">
<id name="Id_Con" type="Int32" unsaved-value="null">
<column name="Id_Con" length="4" sql-type="int" not-null="true" unique="true" index="PK_Contacto"/>
<generator class="native" />
</id>
<property name="Id_Per" type="Int32">
<column name="Id_Per" length="4" sql-type="int" not-null="false"/>
</property>
<property name="Id_Cti" type="Int32">
<column name="Id_Cti" length="4" sql-type="int" not-null="false"/>
</property>
<property name="Fecha_Con" type="DateTime" access="property" >
<column name="Fecha_Con" sql-type="datetime" />
</property>
<property name="Observacion_Con" type="String" access="property">
<column name="Observacion_Con" length="16" sql-type="text" not-null="false"/>
</property>
<property name="Estado_Est" type="Int32" access="property">
<column name="Estado_Est" length="4" sql-type="int" not-null="false"/>
</property>
<property name="Id_Ven" type="Int32" access="property">
<column name="Id_Ven" length="4" sql-type="int" not-null="false"/>
</property>

</class>
</hibernate-mapping>

No hay comentarios: