Uploaded image for project: 'Hibernate ORM'
  1. HHH-11880

Installing an Interceptor in an Integrator is broken

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.0.10, 5.2.10
    • Fix Version/s: None
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Worked in:
    • Last commented by a user?:
      true
    • Sprint:

      Description

      Situation in Hibernate 5

      The test case attached to this issue uses MyIntegrator to install an interceptor using SessionFactoryBuilder.applyInterceptor.

      public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
      	metadata.getSessionFactoryBuilder().applyInterceptor(new GlobalInterceptor());
      }
      

      Expected:

      • The interceptor should be used for new sessions used by the JPA entity manager
      • Specifically: The method GlobalInterceptor.onSave should be called when EntityManager.persist gets called

      Observed:

      • The interceptor is not used at all when using the JPA EntityManager

      Situation in Hibernate 4

      Using Hiberante 4.3 is was possible to install an interceptor using Configuration.setInterceptor.

      public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
      	configuration.setInterceptor(new GlobalInterceptor());
      }
      

      Misc

      We discovered this issue while upgrading to Wildfly 10.1.0 which includes Hibernate 5.0.10.
      This is a critical issue from our point of view, as we have not yet discoverd another hook to install interceptors. Since we are working with the JPA EntityManger we can not use the Session API.

      Link to the discussion on the forum:
      https://forum.hibernate.org/viewtopic.php?f=1&t=1044595&start=0&sid=5ed0e967cd91540236401053e9f66f22

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              christoph.keimel Christoph Keimel
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: