Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid using hibernate schema update

Tags:

hibernate

I use Hibernate in my day-to-day programming tasks and I find it very good. In particular I love the way it manages schema updates while developing, saving me from a lot of headaches.

Anyway they wrote on the docs that it is not recomended in production environment, understandably. So when I update an app on a production server, what can be the industry-standard way? I thought of creating an automated install procedure that dumps the database contents (a backup basically), then call hibernate schema update from code, then runs some tests on queries and so on. Anyway, are there tools around that would do this automatically and are well tested?

Speak out! :)

Thanks.

like image 398
gotch4 Avatar asked Apr 14 '11 12:04

gotch4


2 Answers

Take a look at Liquibase. It's essentially a version control system for your database schema. It nicely integrates with Hibernate, too.

like image 90
ChssPly76 Avatar answered Nov 19 '22 16:11

ChssPly76


Look at Strategies for dealing with constantly changing requirements for MySQL schemas? for a similar question and its answer.

To make it short, once you have a reasonable amount of data and need to migrate it from one schema to another one, you'll need to write SQL scripts to alter your schema and move/transform data.

like image 36
JB Nizet Avatar answered Nov 19 '22 16:11

JB Nizet