-->
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: ConcurrentModificationException and onDelete(...)
PostPosted: Fri Dec 17, 2004 4:00 am 
Beginner
Beginner

Joined: Fri Nov 19, 2004 6:41 am
Posts: 39
Location: Stockholm, Sweden
Hibernate version:

2.1.6

Mapping documents:

None

Code between sessionFactory.openSession() and session.close():

session.delete(obj);

Full stack trace of any exception that occurs:

Cannot show

Name and version of the database you are using:

MS SQL Server 2000

The generated SQL (show_sql=true):

Cannot show

Debug level Hibernate log excerpt:

Dunno


Question

My "value objects" implement the Lifecycle interface 'cause we'd like to do some "conditional cascading".
Well, in the onDelete(...) method I get a ConcurrentModificationException because I'm trying to release/remove some value objects from some java.util.Set's. Well, Hibernate is also iterating the collections (obviously) which causes the exception thrown.

Is there somehow a "proper" way of doing this?

The example of what I'm trying to acomplish is:

Consider table A one-to-many with table B, and table B one-to-many with table C.
Table B is really part of a ternary relationship, but I've omitted that to keep things simple in this example.

The following "modell" describes a relationship where each A, B and C illustrate rows in the tables A, B and C.

Code:
A1 -+- B1 ---C1
    |
    +- B2 --- C2

A2 -+- B3 --- C2
    |
    +- B4 --- C3


If the row A2 where to be deleted, I'd like the following rows to be deleted in a cascade; A2, B3, B4 and C3.
Row C2 should not be deleted cause it's connected with another parent -> A1.
Is this an impossibility or am I just f**king stupid to try this out?!

Regards, Andreas


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 17, 2004 6:58 am 
Beginner
Beginner

Joined: Fri Nov 19, 2004 6:41 am
Posts: 39
Location: Stockholm, Sweden
Solved it... didn't remove references properly!

/Andreas


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.