Hi. As you know, one of Hibernate's powerfull points is the ability to pass detached objects to presentation layer then reassociate them in another transaction. I was thinking about this approach , but I was unable to understand how to pass these detached objects to another session again. I mean we pass detached to presentation layer for displaying purposes (we put these detached objects in request scope for example then forwards the request to JSP page). Some one enlight me please ?
Well, let's first remove the Web stuff out of the equation, because it is the same even if you had a Swing front end. The main point is the Session. You open a Session, and while you query and load objects that are attached to the Session, once you close it, the reference you have is now detached. At some point later you can open a new Session, and re-attach the reference to the Session so that it is once again being managed by the Session. One thing that you will need to do is have a version field so that Hibernate can determine if you have a stale object or not.