-->
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: generated value for a foreignkey which is non id
PostPosted: Mon May 06, 2013 12:46 pm 
Newbie

Joined: Mon May 06, 2013 12:42 pm
Posts: 1
I have the mappings like below in the order

Code:
<hibernate-mapping>
<class name="Map" table="maps" lazy="true">
   <id name="id" type="java.lang.Long" column="mapid">
         <generator class="native" />
   </id>
      
   <set name="preferences" table="preferences" lazy="false" inverse="true" cascade="all-delete-orphan" fetch="select">
      <key column="mapid" not-null="true"/>
      <one-to-many class="Preferences" />
   </set>
      
</hibernate-mapping>



<hibernate-mapping>               
   <class name="Preferences" table="preferences" >
   
      <id name="preferenceId" type="java.lang.Long">
         <column name="preferenceid" />
         <generator class="native" />
      </id>
      
      <set name="subPreferences" table="sub_preferences" lazy="false" inverse="true" cascade="all-delete-orphan" fetch="select">
      <key column="preferenceId" not-null="true"/>
      <one-to-many class="Preferences" />
      </set>
   </class>
</hibernate-mapping>

<hibernate-mapping>               
   <class name="SubPreferences" table="sub_preferences" >
   
      <id name="subpreferenceId" type="java.lang.Long">
         <column name="subpreferenceid" />
         <generator class="native" />
      </id>
      <property name="preferenceid" type="java.lang.Long"  not-null="true">
         <column name="preferenceid"  />
      </property>
   </class>
</hibernate-mapping>




first two entities inserted properly but the third entity is not being inserted and neither giving error. Can any one help what the wrong with this? and how do i resolve this.


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.