[jboss-jira] [JBoss JIRA] Created: (HIBERNATE-61) ConcurrentModificationException when deleting persistent object with list of child-objects

Bas Velthuizen (JIRA) jira-events at lists.jboss.org
Wed Apr 11 05:36:58 EDT 2007


ConcurrentModificationException when deleting persistent object with list of child-objects
------------------------------------------------------------------------------------------

                 Key: HIBERNATE-61
                 URL: http://jira.jboss.com/jira/browse/HIBERNATE-61
             Project: Hibernate
          Issue Type: Bug
         Environment: jboss-4.0.5, hibernate 3.2.3, java 1.5.10, Windows XP Pro
            Reporter: Bas Velthuizen
         Assigned To: Steve Ebersole


Mapping of the persistent class:
  <class name="Rule" table="tbl_rule">
    <id name="id" type="java.lang.Integer">
      <column name="id_rule" />
      <generator class="native" />
    </id>
    <property name="name" type="java.lang.String" access="field">
      <column name="s_name" length="50" not-null="true" unique="true" />
    </property>
    <property name="description" type="java.lang.String">
      <column name="s_description" length="255" not-null="true" default="" />
    </property>
.
.
.
    <list name="commands" table="tbl_command" cascade="all-delete-orphan" inverse="true" lazy="true">
      <key column="id_rule" />
      <list-index column="i_order" />
      <one-to-many class="com.aci.rulesbase.actions.CommandAction" />
    </list>.
.
.
  </class>

Java code:
    getSession().delete((Rule)entity);

the resulting exception is:

 java.util.ConcurrentModificationException
	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
	at java.util.HashMap$ValueIterator.next(HashMap.java:871)
	at org.hibernate.pretty.Printer.toString(Printer.java:90)
	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:97)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
	at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
	at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
	at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
	at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
	... 49 more

I've traced the error until I came to org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions() (line 97)
Here, an iterator is created to write all actions to the log. This only happens if debug-logging is enabled for this class.

A workaround for this is to disable debug-logging in the log4J config file


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list