My persistence.xml
file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="primary">
<jta-data-source>java:jboss/datasources/LMSDS</jta-data-source>
<properties>
<property name="hibernate.event.merge.entity_copy_observer"
value="allow" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
</properties>
</persistence-unit>
</persistence>
If I start my application the tables are created, because hibernate.hbm2ddl.auto
is set to create
. If I add new entities to my application, I don't want the existing data in my database to get lost, but I want to keep it and only create new tables.
How is that possible?