1 Reply Latest reply on Sep 29, 2010 9:17 PM by swd847

    Cannot access outjected objects in entity listener

    buffe.tchamila.gmail.com

      Hi,


      I wrote an entity listener which is responsible for updating the metadata like created by, created time in entities. I tried to access the Seam logger and the outjected User object inside my entity listener but got a null  pointer exception at runtime. when I removed those it worked fine. Is there anything wrong. The code is as below.


      @Name(metaDataListner)
      public class MetaDataListener {


         @Logger
         private Log log;


         @In
         User currentUser;


          @PrePersist
          public void setCreatedBy(SystemMetaData metaData) {
              metaData.setCreatedDate(new Date());
              metaData.setCreatedBy(currentUser.name);
              log.debug(metaData updated);
          }