Use a single persistence unit as both managed and unmanaged unit in JBoss EAP

Solution Verified - Updated -

Issue

  • A persistence unit "MyUnit" is declared in a persistence.xml within <EAR>/lib/psunit.jar
  • Entities within the unit jar are auto-discovered for managed (e.g. injected) entity managers
  • References (e.g. in queries) to the bundled entities fail when using un-managed entity managers

    org.hibernate.hql.internal.ast.QuerySyntaxException: Employee is not mapped [from Employee e]
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • Hibernate 5

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