wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Paul: EJB Transaction types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Paul: EJB Transaction types" Watch "Paul: EJB Transaction types" New topic
Author

Paul: EJB Transaction types

Paul Croarkin
Ranch Hand

Joined: Sep 30, 2004
Posts: 106
Of the six EJB transaction types (Required, RequiresNew, Supports, NotSupported, Mandatory, Never), Required and RequiresNew seem pretty easy to understand, but some of the others are not so clear.

Supports seems to equate to "I don't care" and could be dangerous.

NotSupported and Never also seem like they should be avoided. Would it really hurt to use Required on RequiresNew instead?

Couldn't you use RequiresNew anywhere that you would use Mandatory and avoid the possibility of throwing a TransactionRequiredException?

thanks,
Paul


Thanks,<br /> <br />Paul Croarkin<br />SCEA 5, SCWCD, SCJP
Kai Witte
Ranch Hand

Joined: Jul 17, 2004
Posts: 356
hello,

I append a question about NotSupported:

Does it let a transaction "sleep", so that it can be woken up by a Supports, Required or Mandatory? Would the original transaction of the caller be woken up by any of the three?



Kai


Kai Witte's business website Kai Witte's private homepage
Paul Sanghera
Ranch Hand

Joined: Jul 26, 2005
Posts: 38
Paul:
It always comes down to the basics: the business logic you are using to implement the business requirements of the application, and partly how you are implementing it. For example consider the situation where a transaction is implemented in more than one methods :-). In other words, you have a method that does something which is always a part of a transaction (that has already started) and never a full transaction by itself. Mandatory is the only option you have.

Exercise: Think of an example :-). Hint: Transactions often have more than one steps.
(I guess the teacher inside is taking over me).
Thank you for a very good and thoughtful question, Paul.

Paul

Originally posted by Paul Croarkin:
Of the six EJB transaction types (Required, RequiresNew, Supports, NotSupported, Mandatory, Never), Required and RequiresNew seem pretty easy to understand, but some of the others are not so clear.

Supports seems to equate to "I don't care" and could be dangerous.

NotSupported and Never also seem like they should be avoided. Would it really hurt to use Required on RequiresNew instead?

Couldn't you use RequiresNew anywhere that you would use Mandatory and avoid the possibility of throwing a TransactionRequiredException?

thanks,
Paul

[ July 28, 2005: Message edited by: Paul Sanghera ]

Paul Sanghera, Ph.D.<br />SCBCD, SCJP, Project+, Network+, Linux+, CNA.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Paul: EJB Transaction types
 
Similar Threads
MDB and transaction attributes
Transaction attributes and unspecified transaction context
doubt in ejb transaction
Welcome to our author of the week
HF EJB "Sharpen your pencil p. 497"