Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session is closed

 
aitha suman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please post complete code?
 
aitha suman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont see SessionFactoryUtils.getSession(getSessionFactory() , false)
in the code above
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic