Hi,

I couldn't find any searchable list archive, I read the tutorial
and the dev guide, but ....

Anyways, I've decided to port a fairly simple struts application
to Tapestry, mainly for evaluation and educational purposes. The old app is
also
using Hibernate for O/R persistence services. Hibernate offers lazy loadings
of associations, such that the collection department.employees may not
be loaded until it is actually accessed. In order to use tis feature in
the struts application, and also to avoid extra layers between the bussines
logic and the view layer, I use a servlet filter to open
an Hibernate session and create a transaction for all actions that
entail persistence services. The point here is that the session is open
during the entire rendering process, i.e. I can read the department
and zoom in on a specific employee or all all employees without
any extra effort.

The servlet filter commits or rollbacks the transaction as appropriate and
closes the session. The Hibernate session,
by the way, is stored in a thread local variable. 

Now, before devising my own solution, I wonder how people solve this 
problem in the Tapestry framework? Using struts, it is fairly obvious
to regard the action as being transactional, and it's simple to design
a transactional Action subclass. In Tapestry, I could just use the same
technique, but not all pages are transactional and needs the Hibernate
services. The most obvious counterpart is the Page (or Component), but is
not clear to me how to code a TransactionalPage. This page would open
a Hibernate session and create a transaction before any persistence services
is used; it must also commit or rollback the transaction depending on some
exceptions being thrown from the persistence layer.

So, if anyone has done this and could share some experiences, it would
be appreciated.


At last, Tapestry seems to be an exciting an promising framework, as
I hope this excercise will be as well.

/Per Norrman
###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to