• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[ejb 2 session] default transaction attribute

 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic