[jboss-jira] [JBoss JIRA] (WFLY-10730) Scan for entities in persistence root when using unmanaged JPA persistence unit
Stephen Fikes (JIRA)
issues at jboss.org
Mon Jul 23 12:30:00 EDT 2018
[ https://issues.jboss.org/browse/WFLY-10730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13609360#comment-13609360 ]
Stephen Fikes commented on WFLY-10730:
--------------------------------------
The test can be built running {{'mvn clean package'}} and run by copying {{./javaee-ear/target/javaee-ear-1.0-SNAPSHOT.ear}} to {{<WFLY_HOME>/standalone/deployments}}.
The issue can be seen with the {{'managedUnit'}} on the console:
{code}
... SEVERE [support.jboss.ejb.session.SessionBean] (ServerService Thread Pool -- 89) Failure accessing unit 'managedUnit': org.hibernate.hql.internal.ast.QuerySyntaxException: Employee is not mapped [from Employee e]
{code}
> Scan for entities in persistence root when using unmanaged JPA persistence unit
> -------------------------------------------------------------------------------
>
> Key: WFLY-10730
> URL: https://issues.jboss.org/browse/WFLY-10730
> Project: WildFly
> Issue Type: Enhancement
> Components: JPA / Hibernate
> Affects Versions: 13.0.0.Final
> Reporter: Stephen Fikes
> Assignee: Scott Marlow
> Attachments: testcase.zip
>
>
> Per the [JPA specification|http://download.oracle.com/otn-pub/jcp/persistence-2_2-mrel-eval-spec/JavaPersistence.pdf#G4.1474790], entities in the root should not need to be explicitly specified (they should be automatically discovered). This works in a managed scenario (using injected entity manager) but doesn't work in an un-managed case (entity manager factory / entity manager created explicitly in application code) when using the same persistence unit.
> Also attempted to work around the limitation by declaring an explicit scanner ({{hibernate.archive.scanner=org.jboss.as.jpa.hibernate5.HibernateArchiveScanner}}) but this requires disabling managed JPA for the unit ({{jboss.as.jpa.managed=false}}) so a single unit cannot be used in both managed and un-managed scenarios.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list