Hello everybody,

I want to configure the openjpa.jdbc.SynchronizeMappings property in my 
persistence.xml in a way that it...

1. ... drops all tables in the database schema (drop whole schema)
2. ... recreates the schema
3. ... builds tables for all entity classes

My Intention is, also to clear tables that are not known in the current 
persistence unit including openjpa tables which may have been generated before.

In Ant I solved it that way:

<!-- Define mapping task -->
<taskdef name="mappingtool" 
classname="org.apache.openjpa.jdbc.ant.MappingToolTask">
        <classpath refid="dbbuild.cp"/>
</taskdef>
                
<!-- Mapping task: Drop database (also drop openjpa tables) -->
<mappingtool openjpaTables="true" schemaAction="dropDB"/>
                
<!-- Mapping task: Create database -->
<mappingtool schemaAction="createDB"/>
                
<!-- Mapping task: Build entity schema -->
<mappingtool schemaAction="add">
        <classpath refid="dbbuild.cp"/>
        <fileset refid="entities"/>
</mappingtool>

Theoretically (according to te documentation) it should work with the following 
property configuration in the persistence.xml:

<property name="openjpa.jdbc.SynchronizeMappings" 
value="buildSchema(SchemaAction='dropDB,createDB,add',OpenjpaTables=true)"/>

But it seems, that "OpenjpaTables" is not known as attribute, because I get the 
following error:

Exception in thread "main" <openjpa-1.2.1-r752877:753278 nonfatal general 
error> org.apache.openjpa.persistence.PersistenceException: There was an error 
while setting up the configuration plugin option "SynchronizeMappings". The 
plugin was of type "org.apache.openjpa.jdbc.meta.MappingTool". Setter methods 
for the following plugin properties were not available in that type: 
[DropTables]. Possible plugin properties are: [ACTIONS, ACTION_ADD, 
ACTION_BUILD_SCHEMA, ACTION_DROP, ACTION_EXPORT, ACTION_IMPORT, ACTION_REFRESH, 
ACTION_VALIDATE, DropUnusedComponents, ForeignKeys, IgnoreErrors, Indexes, 
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, 
MODE_NONE, MODE_QUERY, MappingWriter, MetaDataFile, PrimaryKeys, ReadSchema, 
Repository, SCHEMA_ACTION_NONE, SchemaAction, SchemaGroup, SchemaTool, 
SchemaWriter, Sequences].

Is "OpenjpaTables" just not available or has it another name for 
persistence.xml properties?
-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss 
für nur 17,95 Euro/mtl.!* 
http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a

Reply via email to