I am trying to use the long session approach to implement application transaction, so my question is how can I reload an obejct asociated with that session:
class 1{
...
session.save(order);
session.disconnect();
request.getSession().setAttribute("longSession", session) ;
.....
}
class 2 {
...
Session session = (Session) request.getSession().getAttribute("longSession") ;
session.reconnect();
// how to get order object again?
// something like session.getObject(order,orderId) or something?
session.flush();
session.close();
request.getSession().removeAttribute("longSession") ;
......
}
Any idea?
|