Hello,
I am using Cayenned 2.0.4.
What is the proper way to delete the full collection of tomany objects
and have the target object's array correctly reflect the deletion?
The manual (http://cayenne.apache.org/doc20/deleting-objects.html) says
to use dataContext.deleteObjects if you want to delete all objects in
the collection.
What it does not say is that the target object's array will still
contain references to objects that are scheduled for deletion (or have
been deleted after committal).
I have code like this:
System.out.println("paintings: " + artist.getPaintingsArray().size());
// "1"
dataContext.deleteObjects(artist.getPaintingsArray());
System.out.println("paintings: " + artist.getPaintingsArray().size());
// "1"
dataContext.commitChanges();
System.out.println("paintings: " + artist.getPaintingsArray().size());
// "1"
But if I try to delete the objects myself using an iterator as described
on that manual page I get a ConcurrencyModificationException--which is
warned about on that page. It says this may result from the object
being deleted having a "nullify delete rule". However in the modeler
the delete rule for both sides of the relationship is "No Action".
I would appreciate if someone could suggest how I am supposed to do this
(without switching Cayenne versions).
Thanks,
Mark
This archive was generated by hypermail 2.0.0 : Wed Oct 21 2009 - 03:38:40 EDT