-->
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: org.hibernate.SessionException: Session is closed
PostPosted: Sat Nov 03, 2012 3:50 am 
Newbie

Joined: Sat Nov 03, 2012 3:28 am
Posts: 1
this my code
Code:
      try{
         //begin Transaction
         HibernateSessionFactory.beginTransaction();
         
         Desk desk=deskDao.load(Integer.parseInt(deskId));
         //update   
         FoodOrder foodorder = foodOrderDao.startNewFoodOrder(personAmount,operator,desk);
         //save
         foodOrderDao.save(foodorder);
         //commit Transaction
         HibernateSessionFactory.commitTransaction();
      }catch (Exception e) {
         log.error("Exctption==:", e);
         HibernateSessionFactory.rollbackTransaction();
         throw SocketMessage.returnSocketMessage(e,LoginEmployee_Open_Desk_Key);
      }finally {
         //close session
         HibernateSessionFactory.closeSession();
      }
         


Why session is close ???

2012-11-02 16:13:43,757: [HibernateSessionFactory.java:140] [NioProcessor-3] DEBUG socket:::session open==:26299138
2012-11-02 16:13:43,757: [SQLStatementLogger.java:111] [NioProcessor-3] DEBUG org.hibernate.SQL:::
insert
into
intouchdb.foodorder
(BillStatus, BookOrderDetailId, SeatMoney, ServiceMoney)
values
(?, ?, ?, ?)
2012-11-02 16:13:43,757: [EmployeeService.java:126] [NioProcessor-3] ERROR socket:::Exctption==:
org.hibernate.SessionException: Session is closed
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:157)
at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:166)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:142)
at com.inspeed.util.HibernateSessionFactory.commitTransaction(HibernateSessionFactory.java:215)
at com.inspeed.service.EmployeeService.loginEmployee(EmployeeService.java:92)
at sun.reflect.GeneratedMethodAccessor1121.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.inspeed.util.ReflectUtil.reflectInvokeMethod(ReflectUtil.java:37)
at com.inspeed.minaAndroidServer.MinaAndroidDoneMessage.getResultGsonMessage(MinaAndroidDoneMessage.java:129)
at com.inspeed.minaAndroidServer.MinaAndroidDoneMessage.doneMessage(MinaAndroidDoneMessage.java:59)
at com.inspeed.minaAndroidServer.MinaAndroidServerHanlder.messageReceived(MinaAndroidServerHanlder.java:48)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:716)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:427)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:245)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:715)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:68)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1141)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2012-11-02 16:13:43,757: [HibernateSessionFactory.java:168] [NioProcessor-3] DEBUG socket:::session close==:26299138

Please help me look thank's


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.