• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unclear, how to use detached objects in web apps ?

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Mark
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic