I'm using Hibernate, and when I make an update, I give this exception: -
org.hibernate.SessionException: The session is closed! 2015-03-17 17: 04: 54,541 1412797 Error [stderr] (http-0.0.0.0-0.0.0.08080-2 :) org.hibernate.internal.AbstractSessionImpl.errorIfClosed (AbstractSessionImpl.java127) 2015- 03- 17 17: 04: 54,542 1412798 error [stderr] (http-0.0.0.0-0.0.0.0-8080-2) at org.hibernate.internal. Session 17 17: 04: 54,544 1412800 Error [stderr] (http-0.0.0.0-0.0.0.0-8080-2) at org.hibernate.internal.SessionImpl.save (session Impl.java:749) 2015-03-17 17 : 04: 54,545 1412801 Error [stderr] (http-0.0.0.0-0.0.0.0-8080-2) at org.hibernate.internal.SessionImpl.save (session Impl.java:745)Below is my code
set up to set zero (rest rest) {settdao = new setting}; Transaction tr = null; {Try session session = getSession (); Tr = session.beginTransaction (); Session.update (left); Settdao.addSub (rest session); Tr.commit (); Log.debug ("Update successful"); } Hold (exception e) {e.printstacktrace (); }Below the addSub () method in the above update () method: -
Private int addSub (rest, session session) {session {. Save (rest); // here, I get the hibernate exception} hold (exception e) {e.printstacktrace (); } Return 1; }Am I being wrong? What could be the reason. help please.