1 2 Previous Next 17 Replies Latest reply on Dec 10, 2011 11:21 AM by smarlow Go to original post
      • 15. Re: EJBContext not bounded to JNDI in EntityListener
        smarlow

        It sounds like the @PreUpdate case is failing because some cleanup has probably already occurred by the time the container managed commit has occurred.  That is my guess anyway.

         

        The User Transaction works around this because, you are committing the transaction while your bean is still setup (because its in a bean invocation).

         

        Could you create a EJB3/JPA bug report for this and reference this forum.  The link is here.  Please include the workaround also, that could be helpful to others seeing the same issue.

         

        Thanks again for reporting this.

         

        Scott

        • 16. Re: EJBContext not bounded to JNDI in EntityListener
          smarlow

          For easier reference, the relevant JPA 2.0 section 3.5 (Entity Listeners and Callback Methods) specifies:

           

          When invoked from within a Java EE environment, the callback listeners for an entity share the enterprise naming context of the invoking component, and the entity callback methods are invoked in the transaction and security contexts of the calling component at the time at which the callback method is invoked. [44]

           

          [44] For example, if a transaction commit occurs as a result of the normal termination of a session bean business method with transaction attribute RequiresNew, the PostPersist and PostRemove callbacks are executed in the naming context, the transaction context, and the security context of that component.

          • 17. Re: EJBContext not bounded to JNDI in EntityListener
            smarlow
            1 2 Previous Next