0 Replies Latest reply on Oct 1, 2009 3:17 AM by Jeff Palmer

    Unknown Entity Exception

    Jeff Palmer Newbie

      I'm learning Seam by way of the Seam in Action book. So far, I am quite impressed, but have hit a crossroads that I'm hoping someone on here might be able to assist me with.


      When I run the example from chapter 4 of the book, I'm getting the following exception:


      Unknown entity: org.open18.model.Golfer


      The entity class in question is marked with the @Entity annotation and my JavaBean class where I'm referring to the entity is shown below. It looks like the exception is happening on the call to entityManager.persist(newGolfer). The odd thing is, my test class, which is calling the register method, runs fine (no errors and all tests pass).


      I'm using JBoss 5.1.0.GA and Seam 2.2.0.GA.


      Any suggestions?


      @Name("registerAction")
      public class RegisterAction {
      
              @Logger
              private Log log;
      
          @In
          protected FacesMessages facesMessages;
          @In
          protected EntityManager entityManager;
          @In
          protected PasswordManager passwordManager;
          @In
          protected Golfer newGolfer;
          @In
          protected PasswordBean passwordBean;
      
              public String register() {
                      log.info("registerAction.register() action called");
                      log.info("Registering golfer #{newGolfer.username}");
                      if (!passwordBean.verify()) {
                              FacesMessages.instance().addToControl("confirm", "value does not match password");
                              return null;
                      }
      
                      newGolfer.setPasswordHash(passwordManager.hash(passwordBean.getPassword()));
                      newGolfer.setDateJoined(new Date()); // could also do this in a @PrePersist method
                      entityManager.persist(newGolfer);
                      facesMessages.add("Welcome to the club, #{newGolfer.name}!");
                      return "success";
              }
      }