Cosmin's article has many good patterns and ideas, but I'm talking
specifically about a Tapestry feature which lets you customize how
objects are converted to and from strings when passed to and from the
client (e.g. as a service parameter). This lets your listener methods
take BOs instead of BO IDs.
I posted example code just a few days ago:
http://thread.gmane.org/gmane.comp.java.tapestry.user/29378
Hope this helps.
Cheers,
Paul
On Dec 19, 2005, at 7:47 AM, Cosmin Bucur wrote:
article :
http://www.jroller.com/
comments/kbaum/Weblog/orm_lazy_initialization_with_dao
On 12/19/05, Stephane Decleire <[EMAIL PROTECTED]> wrote:
Could you explain your custom SqueezeAdaptor approach a bit more ? It
seems very interesting !
Stephane
Paul Cantrell wrote:
open and close the Hibernate session using a servlet filter, keep
the session on a ThreadLocal while it's open, and never keep
persistent objects in the session (keep their keys instead).
Spring already supply a suitable filter that does this,
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.
My
solution still requires this filter to be present, as it only
attaches
page-persistent objects back into an existing session on the
current
thread.
Ah, I'd missed that on my code skim. In that case, your solution is
totally reasonable -- if you're going to be holding persistent
objects between requests, I can't think of a better way to do it.
But of course only storing object keys in the session is the
leanest
and most
scalable approach,
Agreed....
if you don't mind hitting the database on every request.
If you use Hibernate caching, you're not hitting the DB. I like this
approach best: it keeps data fresh, and you can let you Hibernate
cache plugin deal with data consistency issues instead of your app.
Add to that a custom SqueezeAdaptor that fetches your Hibernate
objects, and you can basically act as though you're just passing
persistent objects to and from listeners, even though they're
magically always a new, up-to-date object on each request.
Cheers,
Paul
_________________________________________________________________
Piano music podcast: http://inthehands.com
Other interesting stuff: http://innig.net
--------------------------------------------------------------------
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: tapestry-user-
[EMAIL PROTECTED]
--
Stéphane Decleire
05 56 57 99 20
06 63 78 69 06
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Piano music podcast: http://inthehands.com
Other interesting stuff: http://innig.net
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]