Why doesn’t my Spring Roo application not retain my data even after changing the persistence type?

In Roo, to change the persistence type, you issue the command.  But this doesn’t take effect and data is not retained for the next run.

jpa setup –provider HIBERNATE –database HYPERSONIC_PERSISTENT

 

Reason:

JPA uses the file - /src/main/resources/META-INF/persistence.xml to specify how existing data should be treated upon every restart of the server.

Solution:

Change the value of <property name=”hibernate.hbm2ddl.auto”>  to “update”

<!– value=”create” to build a new database on each run; value=”update” to modify an existing database; value=”create-drop” means the same as “create” but also drops tables when Hibernate closes; value=”validate” makes no changes to the database –>

<property name=”hibernate.hbm2ddl.auto” value=”update”/>

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: