Good guess and thanks for the clarification ! On 22 mars 2011, at 17:00, Kevin Sutter wrote:
> Hi Jean-Baptiste, > The Mapping Tool has two separate "action" parameters: -schemaAction and > -action. > > -schemaAction build should be similar to the SchemaTool usage: > > - > > build: Generate SQL to build a schema matching the one in the given XML > file. Unlike add, this option does not take into account the fact that > part of the schema defined in the XML file might already exist in the > database. Therefore, this action is typically used in conjunction with the > -file flag to write a SQL script. This script can later be used to > recreate the schema in the XML > > -action buildSchema is more commonly used and I believe is the action you > are really looking for: > > - buildSchema: This is the default action. It makes the database schema > match your existing mappings. If your provided mappings conflict with your > class definitions, OpenJPA will fail with an informative exception. > > Since the Mapping Tool already provides the ability to drop tables: > > - -dropTables/-dt <true/t | false/f>: Corresponds to the same-named > option on the schema tool. > > Since all of the MappingTool parameters should be accessible from the ant > task, the corresponding ant task invocation should be similar to this > (although I have not personally tried it): > > <mappingtool dropTables="true" action="buildSchema"> > <fileset dir="."> > <include name="**/*.java" /> > > </fileset> > </mappingtool> > > > Make sense? I don't use Ant, so I don't know for sure that this all works, > but according to our docs, it should... :-) > > Good luck, > Kevin > > On Tue, Mar 22, 2011 at 10:39 AM, Jean-Baptiste BRIAUD -- Novlog < > [email protected]> wrote: > >> Hi, >> >> There is 2 ways to use the same MappingTool : as a Java class or as an Ant >> task. >> >> >> http://openjpa.apache.org/builds/2.1.0/apache-openjpa-2.1.0/docs/manual/manual.html#ref_guide_integration_mappingtool >> >> http://openjpa.apache.org/builds/2.1.0/apache-openjpa-2.1.0/docs/manual/manual.html#ref_guide_mapping_mappingtool >> >> It look like the same but it is not, at least on syntax point of view : >> >> On command line according to the doc : -schemaAction build >> On ant task : <mappingtool action="buildSchema" >> On reality from my experience for command line : ... -action buildSchema >> >> Currently, I manage to make it work but I'd like to add more parameters >> like -dropTables true. >> What would be the Ant task syntax for it ? >> >> What would be the recommended way to use it ? >> >>
