-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ConcurrentModificationException due to lazy loading
PostPosted: Tue Nov 16, 2004 11:22 am 
Newbie

Joined: Tue Nov 16, 2004 11:02 am
Posts: 1
Location: Utrecht, The Netherlands
Hibernate version: 2.1.6

Full stack trace of any exception that occurs:
Code:
Throwable  java.util.ConcurrentModificationException
                at org.apache.commons.collections.SequencedHashMap$OrderedIterator.next(SequencedHashMap.java:795)
                at net.sf.hibernate.util.IdentityMap.entryList(IdentityMap.java:173)
                at net.sf.hibernate.util.IdentityMap.concurrentEntries(IdentityMap.java:54)
                at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImpl.java:2660)
                at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2250)
                at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1805)
                at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1568)
                at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533)
                at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1521)
                at nl.linkit.projects.sfdc.db2.SynchronizedSession.find(SynchronizedSession.java:116)
                at nl.linkit.projects.sfdc.db2.MachineDaoHib.findMachineData(MachineDaoHib.java:97)
                at nl.linkit.projects.sfdc.operator.MachineSpeedChart2.initCharts(MachineSpeedChart2.java:124)
                at nl.linkit.projects.sfdc.operator.MachineSpeedChart2.init(MachineSpeedChart2.java:80)
                at nl.linkit.projects.sfdc.operator.MachineSpeedChart2.onApplicationEvent(MachineSpeedChart2.java:196)
                at org.springframework.context.event.ApplicationEventMulticasterImpl.onApplicationEvent(ApplicationEventMulticasterImpl.java:63)
                at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:188)
                at nl.linkit.projects.sfdc.operator.OperatorManager.onApplicationEvent(OperatorManager.java:118)
                at org.springframework.context.event.ApplicationEventMulticasterImpl.onApplicationEvent(ApplicationEventMulticasterImpl.java:63)
                at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:188)
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:271)
                at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:58)
                at nl.linkit.projects.sfdc.operator.OperatorConsole.setupApplicationContext(OperatorConsole.java:208)
                at nl.linkit.projects.sfdc.operator.OperatorConsole.startup(OperatorConsole.java:204)
                at nl.linkit.projects.sfdc.swing.ClientConsole.doMain(ClientConsole.java:48)
                at nl.linkit.projects.sfdc.operator.OperatorConsole.main(OperatorConsole.java:70)


Name and version of the database you are using: Oracle 8.1.7

Hi there,

Above is the error thats occurs during startup of my application (1 out of every 4 times). I thought I could not run into this problem, because I am using a singleton for Hibernate access (my SynchronizedSession) and every access of the Session is using a 'synchronized' statement.

However, it turns out that my session.find() is running on the main thread and meanwhile there is some lazy loading of a collection going on in the AWT-EventQueue thread.

I have looked at the Hibernate sourcecode and it is trying to prevent the ConcurrentModificationException by 'cloning' the collection. However, it is now failing during this cloning operation (SessionImpl.preFlushEntities).

My current workaround is to disable lazy loading of all collections, but there is a major performance penalty.

Is there any other way to achieve the same thing? Or is this just the drawback of using a single Session which remains open during the entire lifespan of my Swing application?

_________________
Regards,

Henri ter Steeg


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.