File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts Session Per Request Pattern? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply locked New topic

Struts Session Per Request Pattern?

Jennifer Zhen

Joined: May 24, 2009
Posts: 28
So in Struts, I used an interceptor to open a Spring transaction and commit/rollback later.

Behind the action layer, I do have a service layer providing services to the action classes.

Does it still make sense to have the service method transaction marked as propagation='required'? since a transaction has already been opened at the beginning of the request, propagation='required' would end up with a serial of commits/roll-backs of small nested transactions in the service methods. or would it be more efficient to have the methods marked as propagation="support" or "mandatory" so only one transaction is dealt?

Besides, is it always necessary to manually open a session when opening a transaction? as a session is automatically opened when opening a transaction anyway. And in contrast with many people say about the difference between getSession() and getCurrentSession(), they all used this single same session opened by the transaction. So I got the same session throughout the request no matter what.

did I miss anything?

New to the topic. Any hints/corrections would be appreciated.

I agree. Here's the link:
subject: Struts Session Per Request Pattern?
It's not a secret anymore!