0

I've created a service class loader in a multimodule project while using also Hibernate Integrator to run some DB scripts, but i noticed the application enters my Integrator class 5 times.

I implemented following class:

public class FlywayIntegrator implements Integrator {
    @Override
    public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory,
            SessionFactoryServiceRegistry serviceRegistry) {
        try {
            // some code
        } catch (Exception e) {
            logger.error("Log", e);
        }
    }
    
    @Override
    public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
        // TODO Auto-generated method stub
    }
}

Also under the file \src\main\resources\META-INF\services\org.hibernate.integrator.spi.Integrator i've added the entry:

my.package.FlywayIntegrator

Now , when my application is being deployed, the "integrate" method of my class, is being executed repeatetly 5 times. I could not figure out why it is triggered so many times. Any thoughts would be welcome.

Note: I have 5 different persistence.xml files in 5 different modules, i am not sure if there is a relation. The module containing the Integrator has its own persistence.xml

Stephan
  • 696
  • 15
  • 37

1 Answers1

0

For each module containing a persistence file, the integrator is called one time. In my case, 5 modules i have, contain 5 persistence files.

Stephan
  • 696
  • 15
  • 37