You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Na...@gmx.de on 2009/05/21 19:16:42 UTC

SynchronizeMappings settings

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

Re: SynchronizeMappings settings

Posted by Na...@gmx.de.
Thanks for your reply!

Unfortunately this does not work either. I also tried the variants OpenJpaTables and OpenjpaTables and always get the following error message:

Exception in thread "main" <openjpa-1.2.1-r752877:753278 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: action == OpenJPATables=true
[...]
Caused by: java.lang.IllegalArgumentException: action == OpenJPATables=true

Any ideas?

-Naomi

-------- Original-Nachricht --------
> Datum: Thu, 21 May 2009 15:32:34 -0700 (PDT)
> Von: Pinaki Poddar <pp...@apache.org>
> An: users@openjpa.apache.org
> Betreff: Re: SynchronizeMappings settings

> 
> Hi,
>   Parsing problem with plug-in string.
>   Please try :
> <property  name="openjpa.jdbc.SynchronizeMappings", 
>      
> value="buildSchema(SchemaAction='dropDB,createDB,add,OpenJPATables=true')"/>
> 
>   Notice the single-quotes.
> 
> 
> 
> 
> -----
> Pinaki Poddar                      http://ppoddar.blogspot.com/
>                                       
> http://www.linkedin.com/in/pinakipoddar
> OpenJPA PMC Member/Committer
> JPA Expert Group Member
> -- 
> View this message in context:
> http://n2.nabble.com/SynchronizeMappings-settings-tp2953154p2954570.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-- 
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

Re: SynchronizeMappings settings

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
  Parsing problem with plug-in string.
  Please try :
<property  name="openjpa.jdbc.SynchronizeMappings", 
     
value="buildSchema(SchemaAction='dropDB,createDB,add,OpenJPATables=true')"/>

  Notice the single-quotes.




-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
                                      
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: http://n2.nabble.com/SynchronizeMappings-settings-tp2953154p2954570.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.