This question is for my academic purpose only. Any response will be highly appreciated
Suppose i have a MDB with EJB TransactionAttribute.NOT_SUPPORTED.
@TransactionManagement(TransactionManagementType.BEAN)
@MessageDriven(name = "NonPersistentInquiryMessageBean", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
public class InvoiceInquiryMessageBean implements MessageListener
{
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void onMessage(Message msg) {
//calls a SSB-1 as defined below
//SSB-1.method1()
}
}
@Stateless
public class SSB-1 implements SSB-1Local
{
public void method1(){
}
Question #1. AS i specified NOT_SUPPORTED for onMessage(), container executes the onMessage() without any transaction . When the SSB-1.method1() is invoked from onMessage() , will the container still execute the SSB-1.method1() without any transaction?(as per its definition)
Question #2 If i want the SSB-1.method1 to execute without a transaction should i explicitly mentioned NOT_SUPPORTED for the SSB-1 at the bean or method1() level? or just leave it as it is as the calling OnMessage() is already declared to be NOT_SUPPORTED
Question #3 Assuming the SSS-1.method1() is calling another SSB-2 for which i need to manage transaction, will the definition below work.
@Stateless
public class SSB-1 implements SSB-1Local
{
public void method1(){
//call SSB-2.somemethod();
}
@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class SSB-2
{
@Resource
private UserTransaction userTransaction;
public void somemethod(){
userTransaction.begin();
//biz logic
userTransaction.commit()
}