-->
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.  [ 3 posts ] 
Author Message
 Post subject: collection was evicted
PostPosted: Fri Aug 12, 2005 11:36 pm 
Beginner
Beginner

Joined: Wed Mar 03, 2004 9:44 am
Posts: 23
Location: Brasil
Hello again, about the topic http://forum.hibernate.org/viewtopic.php?t=946224, when I get an OrdemServico object and send the List<DirecionamentoProducao> to a TableModel for show these objects in a JTable, I'm receiving the exception:

Code:

Exception in thread "AWT-EventQueue-0" org.hibernate.HibernateException: collection was evicted
        at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:40)
        at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1437)
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:219)
        at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:81)
        at org.hibernate.collection.PersistentBag.get(PersistentBag.java:392)
        at br.com.feedbackcard.piloto.visao.MDIPrincipal.editarOS(MDIPrincipal.java:2523)
        at br.com.feedbackcard.piloto.visao.MDIPrincipal.btnEditarOSActionPerformed(MDIPrincipal.java:2041)
        at br.com.feedbackcard.piloto.visao.MDIPrincipal.access$3500(MDIPrincipal.java:46)
        at br.com.feedbackcard.piloto.visao.MDIPrincipal$36.actionPerformed(MDIPrincipal.java:1876)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
        at java.awt.Component.processMouseEvent(Component.java:5488)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
        at java.awt.Component.processEvent(Component.java:5253)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1774)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



Anybody can help me?

[]s

Ary Junior


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 18, 2005 3:01 pm 
Beginner
Beginner

Joined: Tue May 11, 2004 12:08 pm
Posts: 38
Location: Davis,CA,USA
I had the same problem and the solution was, just refresh the object before you work on it.

my case

===========================
refresh(A);

A.add(new B());

works

============================
A.add(new B());

fails if there was a Session.clear() before!


Top
 Profile  
 
 Post subject: Refresh works
PostPosted: Mon Nov 14, 2005 6:08 am 
Newbie

Joined: Wed Nov 02, 2005 11:00 am
Posts: 12
Location: Austria, Vienna
I had a similar problem:

For exporting data I'm iterating over objects I get from a query. After exporting an entry I'm flushing the cache with session.clear().

When accessing the next object I got the same exception. So I added a session.refresh(object) before accessing it and the problems are gone!

@wohlgemuth:

Thanks for the hint!

RĂ¼diger Engelberger


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

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.