Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-18848

EntityManager not shared with parent context.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • fuse-7.11-GA
    • fuse-7.10.1-GA
    • Aries, Karaf
    • None
    • False
    • None
    • False
    • % %
    • +
    • Automated
    • Hide

      Use of TxType.MANDATORY does seem to work, but the semantics in the absence of an existing transaction are different from TxType.SUPPORTS, in that MANDATORY forces a failure in the absence of a preexisting transaction scope.

      Show
      Use of TxType.MANDATORY does seem to work, but the semantics in the absence of an existing transaction are different from TxType.SUPPORTS, in that MANDATORY forces a failure in the absence of a preexisting transaction scope.
    • Hide

      Reproducer attached. To test, install a new instance of Fuse/Karaf 7.10 and start it.

      from the Karaf console, run:

      > feature:install jdbc pax-jdbc-h2 pax-jdbc-config pax-jdbc-pool-dbcp2 jpa hibernate transaction jndi
      > install -s blueprint:file:///{path/to/reproducer}/jpa-jta/src/main/config/h2-xa-datasource.xml
      > install -s mvn:fuse-7-10-jpa-jta/fuse-7-10-jpa-jta/1.0.1-SNAPSHOT
      

      Invoke the exposed endpoint with:

      curl -kv http://localhost:8181/cxf/poc/rest-service/performTestNestedSupportsEntityManagerSharing
      
      Show
      Reproducer attached. To test, install a new instance of Fuse/Karaf 7.10 and start it. from the Karaf console, run: > feature:install jdbc pax-jdbc-h2 pax-jdbc-config pax-jdbc-pool-dbcp2 jpa hibernate transaction jndi > install -s blueprint:file: ///{path/to/reproducer}/jpa-jta/src/main/config/h2-xa-datasource.xml > install -s mvn:fuse-7-10-jpa-jta/fuse-7-10-jpa-jta/1.0.1-SNAPSHOT Invoke the exposed endpoint with: curl -kv http: //localhost:8181/cxf/poc/ rest -service/performTestNestedSupportsEntityManagerSharing

      This is a follow-up to ENTESB-16720. When invoking a bean method annotated with @Transactional(TxType.SUPPORTS) from an existing scope (from a method annotated with @Transactional(TxType.REQUIRED) or @Transactional(TxType.REQUIRES_NEW), the invocation fails with:

      java.lang.RuntimeException: Entity created by the parent context not found! EntityManager not shared with parent context.
      

      Changing the attribute from SUPPORTS to MANDATORY allows the transaction to proceed, so it appears that there is a valid transaction context, but for some reason it is not looked up / found when SUPPORTS is used.

            ggrzybek Grzegorz Grzybek
            rhn-support-dhawkins Duane Hawkins
            Stefan Veres Stefan Veres
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: