-->
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: Self referencing unidirectional Many-to-many association
PostPosted: Tue May 27, 2008 9:38 am 
Newbie

Joined: Mon Sep 10, 2007 11:59 am
Posts: 3
Location: BA, Argentina
Hibernate version: 3.2.1.GA

Mapping document:
Code:
<hibernate-mapping>
   <joined-subclass abstract="true"
      name="GeographicEntity"
      extends="Entity"
      table="GEOGRAPHIC_ENTITY">
      <key column="ID_ENTITY" not-null="true" />
      <set name="subparts" table="NESTED_ENTITIES"
         cascade="save-update, merge, delete"         sort="EntityComparator">
         <key column="ID_ENTITY" />
         <many-to-many column="ID_CONTAINED_ENTITY"
            entity-name="GeographicEntity">
         </many-to-many>
      </set>
   </joined-subclass>
</hibernate-mapping>


Database: Oracle

It's a composite, a GeographicEntity can have multiple GeographicEntity childs, and multiple parents, so I'm mapping only the childs (I don't really need parents).

The problem comes when adding elements to the "GeographicEntity" object (subparts). They don't get saved in the many to many table ("NESTED_ENTITIES"), no SQL is generated, I use saveOrUpdate and checked that the geographicEntity has the new elements in the "subparts" collection, but the new relationships never get saved to the database.

Thanks in advance!


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.