4 Replies Latest reply on Mar 26, 2009 4:45 PM by d sailer

    Noob, @In not set

    d sailer Newbie

      I'm sure I'm doing something dumb here but I can't get an @In value injected.

      public class PrePersistListenerImpl implements PrePersistListener {
        private User user;
        public void preUpdate(Object entity) {
          if (entity instanceof LastUpdateAware) {
            LastUpdateAware awareEntity = (LastUpdateAware)entity;
            awareEntity.setTimestamp(new Date());
        public void destroy() {}

      public interface PrePersistListener {
        void preUpdate(Object entity);
        public void destroy();

      public class AuthenticatorImpl implements Authenticator {
        private EntityManager entityManager;
        @Out(required=false, scope = ScopeType.SESSION)
        private User user;
        public boolean authenticate() {
          //TODO: encrypt password
          String qryStr = "select u from User u where u.username=#{identity.username} and u.password=#{identity.password}";
          Query qry = entityManager.createQuery(qryStr);
          List results = qry.getResultList();
          if (results.size() == 0) {
            return false;
          } else {
            user = (User) results.get(0);
            return true;

      debugging shows the value of user is set in authenticate() but null in preUpdate()