aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes default transaction attribute for CMP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "default transaction attribute for CMP" Watch "default transaction attribute for CMP" New topic
Author

default transaction attribute for CMP

Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
If I don't specify the transaction attributes in the deployment descriptor, what are the default transaction attributes for my CMP beans?
Thanks in advance...


SCJP, SCJD, SCWCD, SCBCD, SCEA, IBM Certified Enterprise Developer, WebSphere Studio V5.0
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
There is no default transaction setting:
EJB 2.0 Specification, Section 17.5
The Deployer is responsible for ensuring that the methods of the deployed enterprise beans with container-managed transaction demarcation have been assigned a transaction attribute. If the transaction attributes have not been assigned previously by the Assembler, they must be assigned by the Deployer.

If you do not specify a transaction attribute for methods in an EJB then it's transactional behavior will depend on the particular EJB Container that you are using. Therefore, for portability you should always specify a transaction setting for your EJBs.
[ June 24, 2003: Message edited by: Chris Mathews ]
Nagendra Prasad
Ranch Hand

Joined: Jul 11, 2002
Posts: 219
Sorry if this question is a bit behind EJB2.0... but .. assuming (Thats dangerous.. I know).. that the spec for EJB 1.1 was similar, i.e if transaction not specifically set, then container can assume the default it chooses right.
Mostly, we have followed a pattern wherein we do not set it of the method does not need a transaction.
Would it be better in these cases to have the setting at 'Never' instead? Would that provide any advantage?


Best Regards,<br />Nagendra Prasad.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: default transaction attribute for CMP