Brian Johnson
Brian Johnson

Reputation: 1649

JavaEE deployments: How to keep data after entity/database structure changes?

I have a running JavaEE web application (WAR) whose Entities will be changed in the next version of the application. This also means structure changes in the underlying database of course.

What is the best way to keep your old data and migrate to the new Entity structure after an application rewrite?

Do I have to manually change the database structure before redeploying or are there other ways?

Upvotes: 1

Views: 152

Answers (2)

john miran
john miran

Reputation: 393

In EclipseLink 3.4, adding persistence properties to you persitence.xml.

<property name="eclipselink.ddl-generation" value="create-or-extend-tables" />

<property name="eclipselink.ddl-generation.output-mode" value="database" />

This feature is to allow creating database tables and modify any that already exist so they match the object model.

Upvotes: 1

Jinglue Li
Jinglue Li

Reputation: 127

you would like to version control your upgrade and degrade db script with your codebase. your upgrade scripts should be able to assure the safety of your existing data. and you should always do a back up before you apply your changes. Try liquibase.

Upvotes: 0

Related Questions