-->
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: on-delete=cascade in component collection mapping
PostPosted: Tue Aug 23, 2005 3:09 pm 
Regular
Regular

Joined: Thu Apr 14, 2005 2:15 pm
Posts: 66
I received this error:
org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade": src.model.ParteDeItem.materiais
I understand that I can't use on-delete="cascade" on non-inverse one-to-many associations.
As it is show in my mapping below, I am mapping a collection os component (a collection of value objects). So, this association can't be inverse.
How can I indicate that the foreign key of this association is marked as on-delte=cascade in my database, to avoid several deletes sentences when I delete the owner component ?

Code:
        <idbag name="materiais" lazy="true" cascade="all-delete-orphan"
           table="MATERIAL">
           <collection-id type="integer" column="MATERIAL_ID">
              <generator class="sequence">
                 <param name="sequence">MATERIAL_GEN</param>
              </generator>
           </collection-id>
           <key column="PARTE_ITEM_ID" on-delete="cascade" not-null="true" />
           <composite-element class="src.model.Material">
              <property name="quantidade" />
              <many-to-one name="descricaoMaterial"
                 column="DESCRICAO_MATERIAL_ID" fetch="join" />
           </composite-element>
        </idbag>


Top
 Profile  
 
 Post subject: have the same problems
PostPosted: Fri Apr 14, 2006 2:37 am 
Newbie

Joined: Fri Apr 14, 2006 1:50 am
Posts: 8
Location: Peking
who can help?

_________________
bravery can set you free.


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.