-->
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.  [ 3 posts ] 
Author Message
 Post subject: 2 fields FK'd to the same table. Hibernate wont let me.
PostPosted: Wed Mar 31, 2004 5:33 am 
Regular
Regular

Joined: Mon Oct 20, 2003 3:14 am
Posts: 53
Location: Sterling, VA, USA
Using Hibernate 2.0.3, the following snippet of hbm.xml

Code:

        <many-to-one
            name="fromUser"
            class="bb.model.User"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="UserId"
        />

        <many-to-one
            name="toUser"
            class="bb.model.User"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="UserId"
        />


results in

"Repeated column in mapping for class bb.model.MessageHeader should be mapped with insert="false" update="false": UserId".

These aren't derived properties. Each instance of this object really is associated with two users: A sender and a receiver.

What have I done wrong here?

TIA.

Joe


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 31, 2004 6:51 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
<many-to-one
name="fromUser"
class="bb.model.User"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="SenderId"
/>

<many-to-one
name="toUser"
class="bb.model.User"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="receiverId"
/>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 31, 2004 5:44 pm 
Regular
Regular

Joined: Mon Oct 20, 2003 3:14 am
Posts: 53
Location: Sterling, VA, USA
Thank you.

And may I say, "Doh!"

_________________
"A statistician is a mathmetician, broken down by age and sex".


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

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.