Isn't the boot order pretty much appserver-specific? What is it in JBoss? CDI/JSF/JPA?
Good point about the appserver-specific. It will be CDI/JSF/JPA all deployed in a single war file. It will be deployed on JBoss but in the future for other clients it may need to be deployed on Glassfish or Tomcat.
I looked at liquibase and they use a ServletListener to do the updates at startup, but I am unclear whether that doing it that way is guaranteed to run before JPA starts up.
It seems like JPA and/or Hibernate would have a hook to run code before it starts up but I couldn't find anything on that. I also looked to see if Weld had a way, but I couldn't find it, either.
I would most prefer a solution with Weld.
If you are on JBoss AS and just want to run SQL, Hibernate will execute the import.sql AFTER JPA gets set up.
You can't guarantee any ordering that I know of, and I don't know of a hook to do this.
Yeah I know about import.sql, but the goal is more to help ease customer installations by allowing database schema migrations to automatically run when the website starts up.
I had an idea of creating my own PersistenceProvider and overriding the methods to do my upgrades and then passing off to the Hibernate PersistenceProvider.