Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

JPA Buddy does not generate versionned migration but does like my database was empty

I use the JPA Buddy plugin in the Intellij IDEA editor. My project is a SpringBoot application, and my database is a postgresql database.

I usually use this plugin to be able to quickly generate my SQL migrations when my data model changes in my code. When I initiated my project, I was able to correctly generate and then automatically execute the SQL script to create the database tables.

However, I now need to evolve my entities. So I changed my code to suit my needs. However, when I use JPA Buddy again, the generated migration file ignores the current state of the database, and the generated SQL script creates all the tables as if there were nothing in the database.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’ve searched all over the web, but I haven’t found any similar cases.

>Solution :

My guess is that either your persistence unit is incorrectly configured, or you are comparing the model with the wrong database.

  1. Check if the entities you want to generate scripts for are included in the persistence unit. Configuration of the persistence unit: https://jpa-buddy.com/documentation/database-versioning/#using-a-data-model
  2. Also, make sure your database connection is correctly set up (for example, specifying the schema explicitly if you’re using a non-default one). Connecting to a non-default schema: https://jpa-buddy.com/documentation/database-connections/#postgresql
  3. After that, ensure that you have selected the correct persistence unit and database connection during script generation

diff

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading