-->
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: No DML triggered for Self reference | HBM
PostPosted: Fri Dec 28, 2012 6:52 am 
Newbie

Joined: Thu Oct 25, 2012 3:31 am
Posts: 3
Hi ,

I have a HBM file which contains "person" entity and an attribute named 'Children' (0 to N) in that which is also "Person" entity type.


So a person will have 0 to N children of same Person Type.

When I try

person.setChildren(anotherPerson);


Its inserting only to "Person" table and not "Person_children" table.


Please help me in resolving this.




Code:
<hibernate-mapping auto-import="false">
   <class entity-name="Person" abstract="false" lazy="true" discriminator-value="Person" table="`Person`">

      <id name="id" type="java.lang.String">
         <column not-null="true" unique="false" name="`id`"/>
      </id>
      <property name="name" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
         <column not-null="false" unique="false" name="`name`"/>
      </property>
      <property name="displayName" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.lang.String">
         <column not-null="false" unique="false" name="`displayname`"/>
      </property>
      
      <list name="children" table="`person_children`" inverse="true" lazy="extra" cascade="persist,merge,refresh,save-update,lock">
         
         <key update="true">
            <column name="`person_children_id`" unique="false" index="person_children"/>
         </key>
         <list-index column="`person_children_idx`"/>
         <many-to-many entity-name="Person" unique="true" foreign-key="person_children">
            <column name="`person_id`" unique="false" index="person_children"/>
         </many-to-many>
      </list>
   </class>
</hibernate-mapping>



Thanks,
Appasamy


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.