I have this code that deletes a list of calendar records for a
deactivated employee:
Expression nameExp = ExpressionFactory.matchExp("name", name);
SelectQuery query = new SelectQuery(Calendar.class, nameExp);
List items = dc.performQuery(query);
for (ListIterator it = items.listIterator(); it.hasNext(); ) {
Calendar item = (Calendar) it.next();
it.remove();
dc.deleteObject(item);
}
It worked fine until I added a Nullify delete rule to the Calendar
entity, on a reverse to-many relationship from Calendar to itself. Now
when the commitChanges() happens after the above deletion code, I get:
java.util.ConcurrentModificationException
java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
java.util.HashMap$EntryIterator.next(HashMap.java:829)
java.util.HashMap$EntryIterator.next(HashMap.java:827)
org.objectstyle.cayenne.access.ObjectStoreGraphDiff.validateAndCheckNoop(ObjectStoreGraphDiff.java:109)
org.objectstyle.cayenne.access.DataContext.flushToParent(DataContext.java:1244)
org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1165)
Should I be doing this some other way? This is with version 1.2.
This archive was generated by hypermail 2.0.0 : Mon Aug 07 2006 - 10:37:37 EDT