This question has been asked once here EJB 3 Session Bean Design for Simple CRUD, and I just want to ask more in depth questions about this design. I already tried to ask th
javax.ejb.Remote
is an EJB 3.0 annotation, while java.rmi.Remote
is a plain interface from before EJBs existed. There is no javax.rmi.Remote
. And you are right, if you do not use the Remote
annotation, then by default the EJB will be considered to have only a local interface.From the API doc of TransactionAttributeType.MANDATORY
:
If a client invokes the enterprise bean's method while the client is associated with a transaction context, the container invokes the enterprise bean's method in the client's transaction context.
If there is no existing transaction, an exception is thrown.
You probably want to use TransactionAttributeType.REQUIRED
, which automatically starts a transaction if none is present and is also the default if you use the annotation without a parameter.