0

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.
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

2 Answers2

1

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.

0

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

  • Thank you Carlo! It works for the hibernate update, yes. Also we must pay attention to use the right naming strategy. But the main problem is three different databases and getting diff changelog at the same time. So, I didn't solve my problem yet. – Yusuf Özkan Nov 29 '22 at 21:34