0

For development and deployment of my WAR application I use the drop-and-create functionality. Basically erasing everything from the database and then automatically recreating all the necessary tables and fields according to my @Entity-classes.

Obviously, for production the drop-and-create functionality is out of question. How would I have to create the database tables and fields?

The nice thing about @Entity-classes is that due to OQL and the use of EntityManager all the database queries are generated, hence the WAR application gets database independent. If I now had to create the queries by hand in SQL and then let the application execute them, then I would have to decide in which sql dialect they are (i.e. MySQL, Oracly, SQL Server, ...). Is there a way to create the tables database independently? Is there a way to run structural database updates as well database independently (i.e. for database version 1 to database version 2)? Like altering field or table names, adding tables, droping tables, etc.?

Socrates
  • 8,724
  • 25
  • 66
  • 113

1 Answers1

0

Thank you @Qwerky for mentioning Liquibase. This absolutely is a solution and perfect for my case as I won't have to worry about versioning anymore. Liquibase is very easy to understand and studied in minutes.

For anyone looking for database versioning / scheme appliance:

Liquibase

Socrates
  • 8,724
  • 25
  • 66
  • 113