• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What transaction attributes can apply to session bean methods in EJB 2.0?

 
Joseph Zhou
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all of them? or there is difference between stateful and stateless?
 
Seema Manivannan
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a restriction only if the session bean implements the javax.ejb.SessionSynchronization interface. In this case, the allowed transaction attributes are: Required, RequiresNew, or Mandatory.This is to ensure that the enterprise bean is invoked only in a transaction.
Note that only stateful session beans can implement the SessionSynchronization interface.
Thanks
Seema
[ September 25, 2003: Message edited by: seema manivannan ]
 
hover cheng
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO, only Mandatory, Required, RequiresNew can be specified for Container-managed transaction demarcated session bean. In chapter 17.4.1, ejb spec 2.0:

For entity beans that use EJB 2.0 container-managed persistence, only the Required, RequiresNew, or Mandatory transaction attributes should be used 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. Containers may optionally support the use of the NotSupported, Supports, and Never transaction attributes for the methods of entity beans with container-managed persistence. However, entity beans with container-managed persistence that use these transaction attributes will not be portable.

So, the NotSupported, Supports and Never only apply for Entity Bean with CMP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic