1 Reply Latest reply on Jan 28, 2007 12:31 PM by gavin.king

    Calling java bean from stateful session bean with EntityMana

    yulia

      Hello, I'm evaluating now SEAM framework as new Web development framework for our project. I have some poblems using it.
      I took the Logout stateful session bean as in booking example and separated the db calls outside the ejb:

      public class ChangePasswordAction implements ChangePassword {
      @In(create=true)
      ChangePwdDao changePwdDao;
      
      public String changePassword()
      {
       if ( changePwdDao.changePassword()) {
       FacesMessages.instance().add("Password updated");
       return "main";
       }
       else
       {
       FacesMessages.instance().add("verify", "Re-enter new password");
       changePwdDao.cancel();
       return null;
       }
      }


      In ChangePwdDao:
      @Scope(EVENT)
      @Name("changePwdDao")
      public class ChangePwdDao {
       @In @Out
       private User user;
       @PersistenceContext
       private EntityManager em;
       public boolean changePassword() {
       //using em here
       }
      


      I receive NullPointerException while trying to use EntityManager inside the dao. As I understand SEAM injects the user variable but doesn't inject em (EntityManager).
      I would like to see what's wrong with my code.
      Thank you in advance.