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