-->
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: EntityA contains EntityB id and EntityB instance.
PostPosted: Sat Jun 28, 2008 7:30 am 
Newbie

Joined: Tue Jun 10, 2008 3:51 am
Posts: 10
I am trying to make EntityA contains EntityB id and EntityB instance. But EntityB instance property is only used as a getter, when saving, entityBId should be used.
The mapping file I write is
Code:
   <class name="EntityA"  table="EntityA">
      <id name="Id" type="Int64" column="id" >
         <generator class="native" />
      </id>
      <property name="EntityBId">
         <column name="b_id"/>
      </property>
      <many-to-one name="EntityB" class="EntityB">
         <column name="b_id"/> sql-type="bigint" not-null="false"/>
      </many-to-one>

   </class>

but when running it, nhibernate tell me column "b_id" appears twice and it is invalid. How to correct it? Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2008 4:12 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Try

Code:
<many-to-one name="EntityB" class="EntityB" update="false" insert="false">
         <column name="b_id"/> sql-type="bigint" not-null="false"/>
</many-to-one>

_________________
--Wolfgang


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.