tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal Knüppel (JIRA) <>
Subject [jira] [Commented] (OPENEJB-2120) JPA 2.1 Support
Date Thu, 29 Oct 2015 09:32:27 GMT


Pascal Knüppel commented on OPENEJB-2120:

Hi I've got another question on this issue.

The tip you gave me with unwrap works perfectly fine, but if I inject an EJB that is injecting
an EntityManager and another class that also is injecting an EntityManager of the same persistence-unit,
how could I make sure that the unwrap is reached through the injections?

to make it clearer:

public class MyJUnitTest {

      ... // some OpenEjb configurations

    @PersistenceContext(unitName = DBDefinitions.ORACLE_PERSISTENCE_UNIT)
    private EntityManager oracleEntityManager;

    private Service service;

   public void myTest() {
        oracleEntityManager = oracleEntityManager.unwrap(JpaEntityManager.class);
        // some assertions

public class Service {
    @PersistenceContext(unitName = DBDefinitions.ORACLE_PERSISTENCE_UNIT)
    private EntityManager oracleEntityManager;

    RequestHandler myRequestHandler

public class RequestHandler {
    @PersistenceContext(unitName = DBDefinitions.ORACLE_PERSISTENCE_UNIT)
    private EntityManager oracleEntityManager;

in this example it is obvious that the overriden EntityManager is not reached through to class
Service and RequestHandler. I get the openejb JtaEntityManager in these classes. Is there
a way to guarantee that the injected classes will always have the JpaEntityManager instead
of JtaEntityManager without interfering manually at any spot where the EntityManager is injected?

> JPA 2.1 Support
> ---------------
>                 Key: OPENEJB-2120
>                 URL:
>             Project: OpenEJB
>          Issue Type: Wish
>          Components: general
>            Reporter: Pascal Knüppel
>            Assignee: Romain Manni-Bucau
>              Labels: jpa21
> It would be really great if support for JPA 2.1 was provided. Is there any chance that
support for this api level will come soon?
> In order to keep my Unit-Tests alive I need to downgrade all the requests to the database
to jpa 2.0 which makes working on my project very difficult...

This message was sent by Atlassian JIRA

View raw message