JPA entity autodetection is not working when running in standalone Java SE, "java.lang.IllegalArgumentException: Unknown entity" is thrown

Solution Verified - Updated -

Issue

  • Following exception is being thrown, isn't Java Persistence API supposed to automatically detect deployed entities?

    java.lang.IllegalArgumentException: Unknown entity: xxx
            at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:223)
            at org.apache.jsp.testJPA_jsp._jspService(testJPA_jsp.java:133)
    

Environment

  • Java Persistence API (JPA)
  • Standalone Edition (SE) application

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.