3 Replies Latest reply on Jun 26, 2013 9:31 AM by Scott Marlow

    Running DB migration prior to jpa initialization

    Anil Arora Newbie

      We are running into an issue with Hibernate initialization where our database schema is out of date. So, we want to run some DB migration script on the fly using http://code.google.com/p/flyway/ which needs to get invoked after the DB subsystem is up, but before Hibernate/JPA initialization occurs.

       

      First question, has anyone come up with a solution that is clean and performant?

       

      I was thinking that I could write a JBoss AS extension module to do this and have some sort of deployment mechanism to call the flyway code.  The question was how to ensure the ordering of the deployment initialization so that my code gets called before JPA is called, but after the databases have been deployed as I'll need to access the datasource via JNDI or an API.

       

      Thanks!