This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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 ]
Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
Joined: Feb 27, 2004
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.