Ok.
But I wonder why if I enter a property hibernate tells me that the property is duplicated.
Quote:
<class name="com.Test.User" table="user" >
<id name="usrName" type="java.lang.String">
<column name="usr_name" length="20" />
<generator class="increment" />
</id>
<property name="usrId" type="java.lang.Integer">
<column name="usr_ID" not-null="true" />
</property>
usrName is the PK.
usrId is the FK.
In another class:
Quote:
<class name="com.Table.Main" table="main">
<id name="mainId" type="java.lang.Integer">
<column name="main_ID" />
<generator class="increment" />
</id>
<property name="mainUsrId" type="java.lang.Integer">
<column name="main_usrID" not-null="true" />
</property>
mainId is the PK.
mainUsrId is the FK.
relations are Main.mainUsrID ----N----------1---->User.usrId.
if I follow the example of the first post how should I write this parts:
Quote:
<set name="children">
<key column="parent_id"/>
<one-to-many class="Child"/>
</set>
and
Quote:
<many-to-one="????">
If i add those lines the error is the same: Duplicate property mapping.
thanks!