[jboss-user] [JBoss Seam] - Calling java bean from stateful session bean with EntityMana

Yulia do-not-reply at jboss.com
Sun Jan 28 08:13:42 EST 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4007426#4007426

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4007426



More information about the jboss-user mailing list