I just went thru Hibernate In Action (edition 1), chapter 8.2 (Implementing 
Application Transactions). This chapter talks about the two options we talked 
about, and a third option: Long Session.
 
It seems that "Hibernate in Action" recommends Long session on a web 
application over other two. The next preferred option is "Detached Persistent 
Object Strategy" (same as option 1 in my original email).
 
Will this new information change your opinions on these options?
 
Thanks ....
 
Shovon

----- Original Message ----
From: Patrick Casey <[EMAIL PROTECTED]>
To: Tapestry users <[email protected]>
Sent: Tuesday, January 10, 2006 6:40:29 PM
Subject: RE: Best Practice (Hibernate, Spring, Tapestry)


I'd generally be inclined to go with Option #2. Loading an object in
session A, then reattaching it to session B (with, for example,
Session.lock()) is a bit of a code smell with hibernate, especially if
there's any chance the object might have been changed by another thread
between initial load and reattachment. 

    Likewise there's the issue that if you're storing the whole thing in
the HTTPSession that burns memory *and* requires that all your POJO's
implement serializable. 

    All in all, I'd go with key and reload; it's what I do about 95% of
the time except for a few special cases where I need to keep the object and
session between screen renders, in which case I just store store the
Hibernate session in the HTTPSession (which I wouldn't recommend as a
general case solution).

    --- Pat
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to