You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by fdegrassi <fr...@emaze.net> on 2007/03/25 10:48:41 UTC

Tapestry 4.1.1 and open session in view

I'm having an hard time coming out with a robust solution for 
integrating Tapestry 4.1.1 and Hibernate.
The sample project i'm working on needs to display and edit beans loaded 
by hibernate on the service layer; i've set up a good fetch plan on 
hibernate that minimizes db access and i'm pretty happy with it, and 
until now i manually initialized the lazy collections and references 
needed by the view before passing them to the presentation layer (Tapestry).
This is hard to do, because different pages need different data from the 
beans, and i end up initializing all of the properties and collections 
(the object graph is pretty deep and complex).
I was thinking of using the "Open Session in View" approach, but it 
turns out it does not work very well with Tapestry because of the heavy 
use of serialization in session and in page of objects, so frequently i 
get problems with deserialized objects not bound anymore to the current 
session.
I looked at Tapernate and at Honeycomb, both address the same problem, 
both have really scarce documentation and both seem outdated.
I would really appreciate your expert feedback on this issue.

Should i use tapernate ?
Should i try Honeycomb ?
Should i keep manually initializing my objects ?

Thanks in advance for your help.

Francesco



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: Tapestry 4.1.1 and open session in view

Posted by Ma...@bmw.ch.
Manually initialising collections makes your "service layer"
implementation depend on the presentation layer implicitly. This is
evil.
You'll want to make sure that Hibernate entities are NOT persisted via
standard serialization  but using their hibernate entity-name + id.
While tapernate & honeycomb docs are indeed not very verbose, I'm pretty
sure both mention this.
So, if you're unhappy with tapernate and honeycomb just write your own
   - DataSqueezer 
   - PropertyPersistenceStrategy (and use it instead of "session").
The effect of this will be that in you html as well as in your session
Hibernate entities will be stored like "com.blurb.Person#12" rather than
the base64-encoded default-Serialisation. Your entities, of course,
don't even need to implement Serializable.
Marcus

> -----Original Message-----
> From: fdegrassi [mailto:francesco.degrassi@emaze.net] 
> Sent: Sunday, March 25, 2007 10:49 AM
> To: users@tapestry.apache.org
> Subject: Tapestry 4.1.1 and open session in view
> 
> I'm having an hard time coming out with a robust solution for 
> integrating Tapestry 4.1.1 and Hibernate.
> The sample project i'm working on needs to display and edit 
> beans loaded by hibernate on the service layer; i've set up a 
> good fetch plan on hibernate that minimizes db access and i'm 
> pretty happy with it, and until now i manually initialized 
> the lazy collections and references needed by the view before 
> passing them to the presentation layer (Tapestry).
> This is hard to do, because different pages need different 
> data from the beans, and i end up initializing all of the 
> properties and collections (the object graph is pretty deep 
> and complex).
> I was thinking of using the "Open Session in View" approach, 
> but it turns out it does not work very well with Tapestry 
> because of the heavy use of serialization in session and in 
> page of objects, so frequently i get problems with 
> deserialized objects not bound anymore to the current session.
> I looked at Tapernate and at Honeycomb, both address the same 
> problem, both have really scarce documentation and both seem outdated.
> I would really appreciate your expert feedback on this issue.
> 
> Should i use tapernate ?
> Should i try Honeycomb ?
> Should i keep manually initializing my objects ?
> 
> Thanks in advance for your help.
> 
> Francesco
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org