Joined: Fri Jul 18, 2008 7:45 am Posts: 6
|
I have two tables
USER
{
userId
name
}
CUSTOMER
{
customerId
name
advisor (which is a fk of user)
boss (which is a fk of user)
}
which its corresponding POJO.
How can I map these relationships? I've tried:
<class name="User" table="USER">
<id
name="userId"
type="string"
column="userId"
length="9"
>
</id>
<property
name="name
type="string"
column="NAME
length="30"
/>
</class>
<class name="Customer" table="CUSTOMER">
<id
name="customerId"
type="string"
column="customerId"
length="20"
>
</id>
<property
name="name
type="string"
column="NAME
length="30"
/>
<many-to-one name="advisor" class="User" column="USERID"/>
<many-to-one name="boss" class="User" column="USERID"/>
</class>
but I receive the error:
Repeated column in mapping for entity: User column: USERID (should be mapped with insert="false" update="false")
And I want to update and insert new Customers adding boss and advisor info. Then I can't add the insert and update equals to false.
Thanks in advance.
Best regards,
Paco
|
|