Thanks, Jody. How will that let me provide an SQL script containing CREATE 
TABLE and INSERT statements?

Kay

> On Apr 24, 2015, at 10:51 AM, Jody Grassel <[email protected]> wrote:
> 
> Add the following property to your persistence unit:
> 
> <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)"/>
> 
> 
> 
> On Fri, Apr 24, 2015 at 10:47 AM, Kay Wrobel <[email protected]> wrote:
> 
>> Hi everybody.
>> 
>> I am having a rough time finding a way to initialize an Embedded In-Memory
>> Derby database in my web application. I found a reference on Oracle's web
>> site that states you can initialize a database with DDL and DML statements
>> using properties like the following:
>> 
>>>        <properties>
>>>            <property
>> name="javax.persistence.schema-generation.database.action"
>> value="drop-and-create"/>
>>>            <property
>> name="javax.persistence.schema-generation.create-source" value="script"/>
>>>            <property
>> name="javax.persistence.schema-generation.create-script-source"
>> value="META-INF/sql/create.sql" />
>>>            <property name="javax.persistence.sql-load-script-source"
>> value="META-INF/sql/data.sql" />
>>>        </properties>
>> 
>> 
>> However, that seems to be a new feature in JPA 2.1 spec as part of JEE 6.
>> I am working with OpenJPA provided by Apache TomEE, which is openjpa-2.4.0
>> non-final, a JPA 2.0 implementation I would imagine. The current release on
>> OpenJPA web site is openjpa 2.3.
>> 
>> Is there a way to accomplish this via JPA 2.0  and/or OpenJPA properties?
>> I am trying to initialize an in-memory database for a test case I try to
>> provide to someone.
>> 
>> Any help would be much appreciated.
>> 
>> Kay Wrobel

Reply via email to