I need some assistance in basic understanding of CDI 1.1 and JTA 1.2:
1) If I want the public methods of a JAX-RS resource (and CDI-managed) class to be transactional, then I would just implement the following. Is this correct?
@Transactional
@Path(...)
public class MyResource {
@Inject
public MySharedLogic msl; // shared logic for RESTful WS and Web/JSF/CDI
}
2) If issue 1) is correct, do I still have to annotate the class MySharedLogic with @TransactionScoped ?
Hi Juergen,
1) I think so
2) Yes, you have to specify the scope for MySharedLogic, otherwise the default scope is used (@Dependent pseudo-scope). Note that JAX-RS resource is always request scoped.