0 Replies Latest reply on Mar 14, 2018 9:05 AM by Hans-Michael Rupp

    JSF Web Application Wildfly 10 Unknown entity

    Hans-Michael Rupp Novice

      Hello,

       

      I am trying to build a simple JSF application which saves data entered by the user

      I inject a bean which has been instantiated by a jsf page into a controller and try to persist it from the controller.

      I get a

      2018-03-14 13:41:04,129 ERROR [org.jboss.as.ejb3.invocation] (default task-13) WFLYEJB0034: EJB Invocation failed on component NewsletterDAOBean for method public java.lang.Object de.rupp.persistence.AbstractDAOBean.save(java.lang.Object): javax.ejb.EJBException: java.lang.IllegalArgumentException: Unknown entity: de.rupp.newsletter.NewsletterData$Proxy$_$$_WeldClientProxy

       

       

       

      @FlowScoped("newsletter")
      @Named
      @Entity
      public class NewsletterData implements Serializable {
          
          @Id
          @GeneratedValue
          private Long id;
          private String email;
          private boolean agbChecked;
          
          public String getEmail() {
              return email;
          }
          public void setEmail(String email) {
              this.email = email;
          }
          public boolean isAgbChecked() {
              return agbChecked;
          }
          public void setAgbChecked(boolean agbChecked) {
              this.agbChecked = agbChecked;
          }
          @Override
          public String toString() {
              return "NewsletterData [id=" + id + ", email=" + email + ", agbChecked=" + agbChecked + "]";
          }
          
          
      
      }
      

       

      @Dependent
      @Named
      public class NewsletterController implements Serializable {
          
          @Inject
          private NewsletterData newsletterData;
          
          @Inject
          private NewsletterDAOBean newsletterDAOBean;
          
          
          public String checkAGBs() {
              if (this.newsletterData.isAgbChecked()) {
                  System.out.println(this.newsletterData);
                  newsletterDAOBean.save(this.newsletterData);
                  return "lastPage";
              }
              FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Bitte akzeptieren Sie die AGBs"));
              return null;
          }
      }
      

       

       

      System.out.println(this.newsletterData);

      -> NewsletterData [id=null, email=h.rupp@bla.de, agbChecked=true]

       

      My persistence DAO works. I have written an Arquillian Test which saves a new NewsletterData.

      I use em.persist

       

      Any ideas would be greatly appreciated.