Is it possible to use TransactionManagementType.CONTAINER
instead of TransactionManagementType.BEAN
in a remote EJB implementation?
For further clarification, I don't want to deal with begin
and roolback
methods in my busines layer but I didn't find another way to make it work.
I'm using Glassfish 5 and corbaname:iiop
protocol to access my remote EJB.
Example of usage:
This code block runs on my server:
package br.com;
@Remote
interface IRemote {void method();}
@Stateless
@TransactionManagement(value = TransactionManagementType.BEAN)
class Remote implements IRemote {
@Resource
private UserTransaction ut;
void method(){
try{
ut.begin();
<my business logic>
ut.commit();
}
catch(Exception e){...}
}
And this code block runs in an app on my local machine:
@Stateless
class LocalBean {
@EJB(mappedName = "corbaname:iiop:myserver.com:3700#java:global/RemoteApp/Remote!br.com.IRemote"
private IRemote remote;
}
I'm following this tutorial from Oracle but it uses TransactionManagementType.BEAN
without any explaination.
Is there another way to do this without the need of the transaction above?