I tried the hivetranse approach, but had 2 problems. 1) hivetranse seems
to limit a hibernate session to a single transaction, and 2) its
declarative approach ultimately limits the transaction demarcation to a
single method call, and I couldn't figure out a good way to structure my
application such that all the work (load object, update object, commit
transaction) occurred within the scope of a single service method call
and still left me with a place to catch any exception and update the
view accordingly.
If someone has worked out a good pattern for using hivetranse in the
context of simple hibernate-based CRUD functionality in Tapestry 4 with
validation, I would love to hear about it.
I also looked at what Howard is doing with Epluribus
(http://www.javaforge.com/proj/sources/sccBrowse.do?proj_id=220&dir=epluribus%2Ftrunk),
but that is unfinished (it does have an example of a
WebRequestServicerFilter, which is what you need to make sure the
transaction is committed/rolled-back at the end of the request, as
stated in your question).
I ended up adapting Kent Tong's SessionOwner approach from Chapter 14 of
his indispensable book. It involves injecting the thread-specific
SessionOwner (I called it TransactionManager) into your page and using
it to commit or rollback the transction as desired.
-- Mark R
Sukma Agung Verdianto wrote:
Hi,
I'm trying to implement Open Session in View in tapestry application.
There is a way to create servlet filter to open and close the db session.
(I'm using ServletRequestServicer)
My question is, how can I catch the page exception to rollback the
transaction, because
tapestry ExceptionHandling catch that exceptin and never throw it as servlet
exception.
Sorry for my bad english :(
Rdgs,
Verdianto
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]