• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Adilson Jardim
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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!
 
Alex Sharkoff
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • 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
    • 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.

     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic