-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with mapping
PostPosted: Sat Jun 09, 2007 5:19 am 
Newbie

Joined: Thu May 31, 2007 4:53 am
Posts: 7
Hello, All.
I have two table in my DB. One table consist foreign key to other table.
I use folowing code to refference onto other table.
Code:
<set name="Classes" cascade="all">
      <key column="manufacturer_id"/>
      <one-to-many class="MyProg.DBManufacturer, DBProvider"/>
    </set>


Other table contains the next mapping code:

Code:
<many-to-one name="ManufacturerId"
          class="MyProg.DBRoll, DBProvider"
            column="manufacturer_id"/>


But an exception as apeared:
NHibernate.MappingException : Repated column in mapping for class MyProg.DBManufacturer should be mapped with insert="false" update="false": manufacturer_id

How can I resolve this problem?

Thanks

NHibernate version:1.0.2.0


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 09, 2007 11:45 am 
Senior
Senior

Joined: Sat Aug 19, 2006 6:31 pm
Posts: 139
You need to let hibernate know that one side of the relationship is the owner and the other side is not.

So the many side is usually the owner. So on the NON-owner side, set inverse=true.

<set name="Classes" cascade="all" inverse="true">

_________________
Don't forget to rate the reply if it helps..:)

Budyanto


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.