• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Which the default trans-attribute for all Stateless SB methods ?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have this Stateless Session Bean CMT class



and this ejb DD:


Question:
Which the <trans-attribute> is assumed by container for all methods of MyBean ?

Thanks for all!
 
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Adilson,

EJB 2.0 spec explicitly indicates that the transaction attributes must be defined for certain methods of ejbs (spec's section 17.4.1):


The transaction attribute must be specified for the following methods:

  • For a session bean, the transaction attributes must be specified for the methods defined in the bean�s component interface and all the direct and indirect superinterfaces of the component interface, excluding the methods of the javax.ejb.EJBObject or javax.ejb.EJBLocalObject interface. Transaction attributes must not be specified for the methods of a session bean�s home interface.
  • For an entity bean, the transaction attributes must be specified for the methods defined in the bean�s component interface and all the direct and indirect superinterfaces of the component interface, excluding the getEJBHome, getEJBLocalHome, getHandle, getPrimaryKey, and isIdentical methods; and for the methods defined in the bean�s home interface and all the direct and indirect superinterfaces of the home interface, excluding the

  • getEJBMetaData and getHomeHandle methods specific to the remote home interface.
  • For a message-driven bean, the transaction attribute must be specified for the bean�s onMessage method.



  • In theory I'd expect Container to complain when it finds that one (or more) ejb has no transaction attributes defined on its methods. However, in practice it looks different. Eg, JBoss assumes Required trans attribute on the methods that have no transaction attributes defined in ejb-jar.xml. I am not sure about other app servers

    I guess the bottom line is this - Application Assembler (or Deployer) has to always define transaction attributes for all methods that must have these attributes defined.

    Hope it helps
    [ July 15, 2004: Message edited by: Alex Sharkoff ]
     
    Adilson Jardim
    Greenhorn
    Posts: 10
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks Alex !

    This is the exactly that I needed!
    I am using the JBoss!

    I think that if no default attribute was assumed by the container would be more easy to discover given that one exception would be launched in start of the server.

     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic