-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Map same property in multiple join mapping
PostPosted: Wed Dec 10, 2008 4:54 pm 
Newbie

Joined: Thu Dec 23, 2004 6:08 am
Posts: 4
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.