• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Portable transaction

 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is another question I posted in the wrong forum.

Why are NotSupported, Supports, and Never transaction attributes NOT PORTABLE? Is that because methods in these attributes might not be in transaction context?

Thanks
Shiang
 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you are right.

There is this similarity among
NotSupported, Supports, and Never : all have a possibility that the method that they mark/describe run with an "unspecified transaction context".

While Required, RequiredNew and Mandatory have this �opposite� similarity : all DOES NOT have a possibility that the method that they mark/describe run with an "unspecified transaction context".

A method written by a Bean Provider (BP) might have code that calls these CMT transaction methods :
entityContext.getRollbankOnly() or
entityContext.setRollbankOnly().
These methods need a transaction context to run.

If the BP's method DOES have one of these xxxRollbankOnly methods AND if the method IS mark as NotSupported, Supports or Never, then problem will occur. This is possible since the Application Assembler or the Deployer most probably does not have access to the code.

I think the �problem� mentioned above is that the container will throw TransactionRequired<Local>Exception. (Can someone verify this ?)

I guess this should be the reason why NotSupported, Supports, and Never are labelled as NOT PORTABLE. They are not versatile enough to be used in every possible way.
 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. Your answer helps me with my confidence in the exam.

Shiang
 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found my answer in spec pg. 352.

Shiang
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic