cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Lewis <br...@maine.rr.com>
Subject ConcuirrentModificationException with delete rule
Date Mon, 07 Aug 2006 14:37:09 GMT
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.







Mime
View raw message