0 Replies Latest reply on Oct 16, 2012 10:57 AM by Moe Pad

    Intercept SessionSynchronization

    Moe Pad Newbie



      I try to intercept the methods of javax.ejb.SessionSynchronization with a decorator. My decorator looks like that:


      @Decoratorpublic abstract class EJBRollbackDecorator implements MyTestBean{
        private MyTestBean myTestBean;
        ByteArrayOutputStream serializedObject = new ByteArrayOutputStream();
        Logger logger = Logger.getLogger(this.getClass().getName());
        public EJBRollbackDecorator() {
        public void postConstruct() {
          logger.info("[DECORATOR]: constructed = " + this);
        public void afterBegin() {
          logger.info("[DECORATOR]: afterBegin");
        public void afterCompletion(boolean committed) {
          logger.info("[DECORATOR]: afterCompletion");
        public void decoratorTest() {
          logger.info("[DECORATOR]: decoratorTest = " + this);


      Of course, MyTestBean implements SessionSynchronization.


      When a new transaction is started (or committed) none of the methods of the decorator is called. But if I call the decoratorTest() method of my test bean everything works fine.


      Is this a bug or are the methods of SessionSynchronization not supposed to be intercepted?


      Thanks in advance,