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: Exception: Session is closed during the SaveOrUpdate command
PostPosted: Wed Apr 05, 2006 3:46 am 
Newbie

Joined: Wed Apr 05, 2006 3:02 am
Posts: 1
Hello,
to save an object created in an other class and updated in the GUI I implemented the commit command. During the execution of the saveOrUpdate method I get an exception Session is closed!

[b]Hibernate version:[/b] 3.1.3, but I have tried it also with hibernate 3

For test I created the same object in this class (auftrag) - it is possible to save it. But I don't understand, why I can't save my real object (currentRow). I guess the problem in the super class, because in other components derived from this super class appears the same problem but all the debugging doesn't bring me further.

[b]Code inside of the try block:[/b]
[code]Session session = getCurrentSession();
session.close();
session = getCurrentSession();
System.out.println("session is open: "+session.isOpen()); //true
tx = session.beginTransaction();
IAuftraegeErfProxy auftrag = new AuftraegeErf();
session.saveOrUpdate(auftrag);
tx.commit();

//now the same with the currentRow
session.close();

session = getCurrentSession();
System.out.println("session is open: "+session.isOpen()); //true
tx = session.beginTransaction();
IAuftraegeErfProxy currentRow = (IAuftraegeErfProxy) getCurrentRow();

session.saveOrUpdate(currentRow); //here the exception will be thrown[/code]
[b]Full stack trace of my exception:[/b]org.hibernate.SessionException: Session is closed!
at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:50)
at org.hibernate.impl.SessionImpl.getPersistenceContext(SessionImpl.java:1795)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:228)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:114)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:530)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:522)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:518)
at de.innosystec.lde.component.RecordalJobComponent$CommitCommand.execute(RecordalJobComponent.java:934)
at de.innosystec.framework.command.AbstractCommand.invoke(AbstractCommand.java:103)
at de.innosystec.framework.action.CommandAction.actionPerformed(CommandAction.java:112)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


[b]Name and version of the database you are using:[/b]Oracle 9.3

Can somebody help me?
Many thanks,
Sonja


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.