I have been working on backend for a Java webApp and have been having difficulty getting openjpa to create my database schema. I am using openjpa, with tomEE.
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="webAppPU" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>webApp</jta-data-source>
<class>com.webapp.model.RoleEntity</class>
<class>com.webapp.model.Shift</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="openjpa.jdbc.Schema" value="APP"/>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="javax.persistence.schema-generation.create-datbase-schemas" value="true"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
</properties>
</persistence-unit>
</persistence>
I have tried many combinations of properties in the persistence.xml file. Originally I started with just schema-generation property and on deploy I expected to see a schema with my two classes / tables ( RoleEntity and Shift ). I have tried some different properties and have yet to find a config that creates the schema on deploy.