I'm a bit confused about this, the specs says (17.4.1) :
The transaction attribute must be specified for the following methods:
- Session: methods in the component interface and super interfaces - Entity: methods in component/home interface and super interfaces + remove methods in EJB(local)Object/EJB(local)Home interfaces - Message driven: onMessage
Now, how do I see this 'MUST' context ? Do these methods NEED to have a transaction context ? ...
For example; I can create an CMT session bean and do not specify the 'container-transaction' element at all in the deployment descriptor. The same for an entity bean...
Do not get confused by some Containers which allow you not to specify transaction attributes (because they will use default values). If the EJB spec says "must", then it is mandatory. The spec is the supreme authority as far as the exam is concerned.
Ok, but, can you confirm that for a bean (take a SSB for example) you *MUST* specify a transaction attribute in the assembly descriptor for every method in the component interface ?
Assume the component interface of that SSB with the following method:
"public int returnCurrentTime() throws RemoteException;"
In order for this to be a legal SSB, I must declare the following assmembly descriptor:
<assembly-descriptor> <container-transaction> <trans-attribute>some trans attrib here</trans-attribute> <method>returnCurrentTime</method> </container-transaction> </assembly-descriptor>
If I do not specify this it is not valid then ?
I find it a bit hard to accept since it is the first thing I hear about this. I always thought that when you do not want a method to use transaction you simply do not specify the methods in the container-transaction of the assembly descriptor..
I do some of my very best work in water. Like this tiny ad: