HI, I did but no changements: here's my ant file the command I use is ant
schema2file
<?xml version="1.0" encoding="UTF-8"?>
<project name="openJPATools" default="help" basedir=".">
<!-- Properties -->
<property name="src.dir" value="${basedir}/ejbModule" />
<property name="bld.dir" value="${basedir}/build" />
<property name="mdl.dir" value="${bld.dir}/model" />
<property name="lib.dir" value="${basedir}/lib" />
<!-- Define the mappingTool task. -->
<property name="mappingTool"
value="org.apache.openjpa.jdbc.ant.MappingToolTask" />
<!-- Define the reserveMappingTool task. -->
<property name="reverseMappingTool"
value="org.apache.openjpa.jdbc.ant.ReverseMappingToolTask" />
<!-- Define the schemaTool task. -->
<property name="schemaTool"
value="org.apache.openjpa.jdbc.ant.SchemaToolTask" />
<!-- Define the persistence file. -->
<property name="persistence"
value="${basedir}/ejbModule/META-INF/persistence.xml" />
<!-- Encoding language -->
<property name="encode" value="UTF-8" />
<!-- Debuggin (true/false) -->
<property name="debug" value="true" />
<!-- Debug level (lines|vars|source) more then one keyword can be
specified. -->
<property name="debugLevel" value="lines,vars,source" />
<!-- Define the filename where the create schema will be stored. -->
<property name="createSql" value="${basedir}/create.sql" />
<!-- Define the filename where the update schema will be stored. -->
<property name="updateSql" value="${basedir}/update.sql" />
<!-- Show possible options. -->
<target name="help">
<echo>Available targets:
- clean
- build
- schema2file
- schema2db
- upschema2file
- upschema2db</echo>
</target>
<!-- Initialization, Things to do before starting. -->
<target name="init">
<mkdir dir="${mdl.dir}"/>
</target>
<!-- Define the library path. -->
<path id="classpath">
<fileset dir="${basedir}">
<include name="**/*.jar" />
</fileset>
</path>
<!-- Build all files. -->
<target name="build" depends="init" description="Generates java classes">
<javac srcdir="${src.dir}" destdir="${mdl.dir}" debug="${debug}"
debuglevel="${debugLevel}">
<classpath refid="classpath" />
</javac>
</target>
<!-- Export the Schema to a File. -->
<target name="schema2file" depends="build" description="Generates and
export the schema to a file.">
<taskdef name="mappingtool" classname="${mappingTool}">
<classpath refid="classpath" />
</taskdef>
<mappingtool action="buildSchema" schemaaction="build"
sqlFile="${createSql}" foreignkeys="true">
<config propertiesFile="${persistence}" />
<classpath>
<pathelement location="${mdl.dir}" />
</classpath>
</mappingtool>
</target>
<!-- Export the Schema to the Database. -->
<target name="schema2db" depends="build" description="Generates and export
the schema to the database.">
<taskdef name="mappingtool" classname="${mappingTool}">
<classpath refid="classpath" />
</taskdef>
<mappingtool action="buildSchema" foreignkeys="true">
<config propertiesFile="${persistence}" />
<classpath>
<pathelement location="${mdl.dir}" />
</classpath>
</mappingtool>
</target>
<!-- Export the updated Schema to a file. -->
<target name="upschema2file" depends="build" description="Update and
export the schema to a file.">
<taskdef name="mappingtool" classname="${mappingTool}">
<classpath refid="classpath" />
</taskdef>
<mappingtool sqlfile="${updateSql}">
<config propertiesFile="${persistence}" />
<classpath>
<pathelement location="${mdl.dir}" />
</classpath>
</mappingtool>
</target>
<!--Export the updated Schema to the database. -->
<target name="upschema2db" depends="build" description="Update and export
the schema to the database.">
<taskdef name="mappingtool" classname="${mappingTool}">
<classpath refid="classpath" />
</taskdef>
<mappingtool action="buildSchema">
<config propertiesFile="${persistence}" />
<classpath>
<pathelement location="${mdl.dir}"/>
</classpath>
</mappingtool>
</target>
<!-- Cleanup the build directory. -->
<target name="clean">
<delete dir="${bld.dir}" />
</target>
</project>
Daryl Stultz wrote:
>
> On Thu, Oct 15, 2009 at 8:15 AM, yokenji <[email protected]> wrote:
>
>>
>> When I do an export with the MappingTools to a sql file I cant' see my
>> Foreignkeys how does it come?
>>
>
> If you are using Ant, add foreignKeys="true" to <mappingtool>. If using
> the
> command line tool, include -foreignKeys true.
>
> --
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:[email protected]
>
>
--
View this message in context:
http://n2.nabble.com/Set-ForeignKey-tp3828908p3829022.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.