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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content