Jochen Wiedmann schrieb:
> On 2/7/07, Werner Punz <[EMAIL PROTECTED]> wrote:
> 
>> Right idea wrong tier of the application stack, automated transaction
>> handling is in the realm
>> of the middleware, I highly can recommend to have a look at EJB3 and/or
>> Spring maybe even Seam.
>> Thing is automated transaction handling is already covered
>> by apis like Java Transaction API, the @Transactional annotation
>> of Spring or EJB
>> and or various other constructs in Spring or EJB.
>> JSF itself is mainly the view layer.
> 
> I must admit, that I have no idea about Spring. However, the Java
> Transaction API, and/or EJB do clearly not cover these topics. I
> wouldn't want to like to discuss this in detail, but I know of no
> application where I didn't require a UserTransaction sooner or later.
> And then I am back to my original question: How do I control it
> automatically?
> 



ok if you want to bypass the app servers transaction mechanisms, then
you have various options:

First of all, you have to implement the rollback/commit and
opentransaction parts yourself in most cases.
Secondly there are various hook points to add it, if you want to have it
semi generic in the view layer such as:

a) Write your own view handler which roots basically into the original
one, but deals with the transactions

b) use a generic opensessionin view filter or something similar which
hooks into the servlet api

c) write your own servlet filter to deal with it

d) Use the shale view controller which has clear callback points which
are always called and add your transaction code there

One option is out of question, if you want to use phase listeners for
it, forget it, phase listeners can be called but mustn't.

The others is up to your choice.

Reply via email to