Two Laptop Bag*
The moose likes Spring and the fly likes session is closed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Spring
Bookmark "session is closed" Watch "session is closed" New topic
Author

session is closed

aitha suman
Greenhorn

Joined: Oct 31, 2011
Posts: 2
Hi,

I am using below code for getting a session in a method of serviceImpl class and calling this method from a run method of a thread class.

SessionFactoryUtils.getSession(getSessionFactory() , false)

but in production i got a hibernate exception and session is closed and exception details are below. This exception is came only once.



Please give me solution for this issue and tell me why it is coming
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

can you please post complete code?


===Vyas Sanzgiri===
My Blog
aitha suman
Greenhorn

Joined: Oct 31, 2011
Posts: 2
if (totalQSShares > 0)
{
QuicksellType quicksellType = (QuicksellType) session.load(QuicksellType.class, isForcedQS ? "FORCED" : "ELECTIVE");
QuicksellStatus quicksellStatus = (QuicksellStatus) session.load(QuicksellStatus.class, "BATCHREL");

Quicksell quicksell = new Quicksell();
quicksell.setQty(new Double(totalQSShares));
quicksell.setBatch(equityBatchLoadCntl);
quicksell.setType(quicksellType);
quicksell.setStatus(quicksellStatus);
quicksell.setLastUpdatedBy(loginUser);

session.save(quicksell);
}
tx.commit();


The above code deployed in websphere server.
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

I dont see SessionFactoryUtils.getSession(getSessionFactory() , false)
in the code above
 
GeeCON Prague 2014
 
subject: session is closed