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