Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Invoke transactional method within the same SFSB
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- @Stateless
- public class MyService {
- @Resource
- SessionContext ctx;
- public void myMethod() {
- // do something...
- // invoke method from the same class
- // As expected - this doesn't work as it's a regular local-call,
- // it's not aware of EJB nature of this call.
- save();
- // Doesn't work (although it worked with SLSB)
- ctx.getBusinessObject(MyService.class).save();
- }
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- public void save() {
- // do something...
- }
- }
Add Comment
Please, Sign In to add comment