Bookmark Topic Watch Topic
  • New Topic

Struts Session Per Request Pattern?  RSS feed

Jennifer Zhen
Posts: 28
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.

    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!