-->
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: cascade/flush again...
PostPosted: Mon Dec 08, 2003 7:43 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Hey,
again a flush-cascade problem!

I have a complex construct of relations and any type mappings!

Class A(JasBeanImpl) stands in a bidirectional one-to-many relationship
with class B(KeyValueTuple)!
Code:
<set name="KeyValueTuples"
     lazy="true"
     inverse="true"
     cascade="all-delete-orphan">
   <key column="fkJasBean"/>
   <one-to-many class="org.weta.jas.hibernate.KeyValueTuple"/>
</set>


Class B(KeyValueTuple) uses any type mapping :
Code:
<any name="value"
     id-type="long"
     cascade="all" >
   <column  name="class_name" />
   <column  name="class_id"   />
</any>


The any type mapping of class B should f.e reference a collection of objects, so i wrote a class C (HValueCollection), which stands in a one-to-many relation with class D (HValue)!
Code:
<set name="HValues"
     lazy="true"
     inverse="true"
     cascade="all-delete-orphan">
  <key column="fkCollection"/>
  <one-to-many class="org.weta.jas.hibernate.HValue"/>
</set>


Class D itself has a any type mapping too!

Code:
<any    name="value"
     id-type="long"
     cascade="all">
   <column  name="class_name"  />
   <column name="class_id"         />
</any>


Thats the basic structure!
(A----rel----B----any----C----rel----D----any----..)

Now saving works fine!
Quote:
(1)

If i remove an object of class A (remove(a);) it still works, everything which stands in relation or is referenced from a is deleted!

Quote:
(2)

If i remove an object of class B(b child of A), which any type mapping points to a standalone hibernate class Z, it works too!

Quote:
(3)

But if i remove an object of class B which any type mapping points to an object of class C, following error occured:

[STDERR] net.sf.hibernate.HibernateException: Flush during cascad
en re-saved by cascade (remove deleted object from associations)
ibernate.impl.SessionImpl.flush(SessionImpl.java:2176)
...


I remove it just by removing the element from the Set of class A, and update class A. (update()+flush())

I tried to use proxys and override equals() for all classes.
I tried to set all cascades to none, saving and deleting all manually, but in case
Quote:
(3)

still the same error!

Quote:
(4)

If i create an object of class C with some mappings to D, deleting works,
Just all in all the error appears!

I have no more ideas...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 8:16 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Sorry!
stupid f.. mistake!

Had the same object of class B in relation to one object of A twice!
Now the scenario works!


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.