I need to map a class to two tables:
Code:
class Customer{
int id;
String firstName;
String lastName;
String street;
String zip;
String updateUser;
}
Customer: columns(id, street, zip, updateUser)
CustomerName: columns(customer_id, firstName, lastName, updateUser)
I do this with the join mapping:
Code:
<class name="Customer" table="Customer">
<id column="id" name="id"/>
<property column="street" name="street"/>
<property column="zip" name="zip"/>
<property column="updateUser" name="updateUser"/>
<join table="UADJ_FILTER_HDR">
<key column="customer_id" property-ref="id"/>
<property column="firstName" name="firstName"/>
<property column="lastName" name="lastName"/>
<property column="updateUser" name="updateUser"/>
</join>
</class>
Both tables track the update user and in the object it is the same field and so the field is mapped to different column in two different join. I am getting an error like this:
Duplicate property mapping of updateUser found in Customer.
I know the design is not the best, but assuming that I am not allowed to change the legacy schema and class structure, is it possible to map the same property to two different tables.