File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes [ejb 2 session]  default transaction attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "[ejb 2 session]  default transaction attribute" Watch "[ejb 2 session]  default transaction attribute" New topic
Author

[ejb 2 session] default transaction attribute

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2061
Hello,

For the code below, in relation to a session bean named theEjb, from ejb-jar.xml,

1) Is container-transaction tag, or its corresponding bmt tag, required? Or is there a default? E.g. if I dont declare any container-transaction tag like below, all methods of 'theEjb' will have the default transaction attributes (e.g. whatever is the default, e.g. 'Supports')?

2) If I have a method 'method2', with the definition below, specified, what will method2's transaction attribute going to be in runtime? Supports? or NotSupported ? or Never? etc.?

Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1096
    
  10

Jesus Angeles wrote:
1) Is container-transaction tag, or its corresponding bmt tag, required? Or is there a default? E.g. if I dont declare any container-transaction tag like below, all methods of 'theEjb' will have the default transaction attributes (e.g. whatever is the default, e.g. 'Supports')?

The tag is not mandatory. If the tag is not present, then I think it means bean-managed. If it is bean-managed, the transaction attributes do not come into play at all.

Jesus Angeles wrote:
2) If I have a method 'method2', with the definition below, specified, what will method2's transaction attribute going to be in runtime? Supports? or NotSupported ? or Never? etc.?

As far as I remember, the default value was not well-defined in the specification for EJB 2 - I think it was corrected in EJB 3. So, in EJB 2, the default value differed between vendors.

You can use the '*' pattern in the method name and provide a transaction attribute for all methods at one stretch. Like:

So, you can define one for a specific method and define another attribute for the rest.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
 
Don't get me started about those stupid light bulbs.
 
subject: [ejb 2 session] default transaction attribute