Home > Mobile >  How to create diff changelog file from JPA entities for different databases at the same time?
How to create diff changelog file from JPA entities for different databases at the same time?

Time:11-28

I want to create Liquibase changelog file based on differences between my database and my Hibernate entities for different database environments, therefore different datatypes in Oracle, SQL Server and PostgreSQL. And it's a Maven Project. So, is there any Maven plugin or can be generated to do this operations?

Also I tried liquibase-hibernate plugin, but it is not working properly, sometimes diff cannot see any difference although I made changes in Entity.java.

So this is what I wanted as a workflow in dev;

  1. Make a change in my Entity.java
  2. Run a command like mvn:migrateAll including liquibase diff
  3. Changelog file for all databases are generated based on difference
  4. Run mvn:liquibase update command to update my tables.

CodePudding user response:

You can try JPA Buddy (https://www.jpa-buddy.com/), but it costs. Three weeks ago, I tried to use the liquibase-hibernate plugin and I had the same results (no changelog generated). I did not spend much time on it back then, maybe I missed some configuration.

CodePudding user response:

After making changes to your entities, execute "mvn compile", after that execute the maven liquibase diff command.

  • Related