• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

[ejb 2 session] default transaction attribute

 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.?

 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Message for you sir! I think it is a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic