• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transaction Attribute - Not Supported

 
Tmmet Johnson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a question in transaction attribute.
In my stateless sessionbean methods, I just use select sql queries to fetch the data from the database.
My question is "Can I set the transaction attribute to NotSupported for the above bean methods?"
Thanks in advance,
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't need a transaction, then NotSupported is fine - much better than Supports.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can set the transaction property to "NotSupported" but there will be two potential drawbacks:

- Let's say you have Entity beans in the transaction and has performed DML on the database before calling the SLSB. The query you execute on SLSB will not show the updates done by Entity beans (this depends on DB)
- There will be performance issue in Context switch from the transaction. Container has to suspend the transaction and execute your SLSB and resume the transaction.

It's better to set the transaction property to "Supports" if the SLSB is invoked as part of ongoing transaction.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is hard to think of a good reason why the Supports attribute should ever be used.

If a SLSB should participate in an incoming transaction, then the Required attribute is more appropriate.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Supports can be used to make container not to suspend the transaction and do context switch provided SLSB is not depedent of the incomming transaction results. Required can be used if SLSB depends on the transaction. The point is to avoid overhead in the container to switch out/on of transaction context.
 
Tmmet Johnson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all your answers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!