0 Replies Latest reply on May 20, 2013 11:03 PM by emiddio

    OC4J EJB3.0 Bean managed transaction support @TransactionManagement

      When I change a default Container Managed Transaction EJB3.0 EJB with

      @TransactionManagement(TransactionManagementType.BEAN) // annotation added, none by default
      @Stateless(name = "SerivceCAMInfoReqHandler")
      public class ServiceCAMInfoReqHandlerBean implements ServiceCAMInfoReqHandler {

      the following code always returns null for TargetInfo ti,
      @PersistenceContext(unitName = "felix")
      private EntityManager entityManager;
      TargetInfo ti = entityManager.find(TargetInfo.class, targetInfo.getTargetInfoId());

      entityManager.find should work always as I understand - Pro JPA2.0 book, regardless if or not part of a JTA Transaction.
      The code does work in Glassfish V3.1.2.2.

      Outside of an EJB I can be required to use @PersistenceUnit to get an EntityManagerFactory to then get an EntityManager instance.
      This attempt inside EJB also fails to result in entityManager.find to work, return a non null value.

      I have not tried RESOURCE-LOCAL transactions, I did not add a JTA-Transaction to oc4j's persistence.xml , as JTA is default.

      Is this a bug - or am I doing something wrong in OC4j ?