All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapping.build.xml Maven / Gradle / Ivy

There is a newer version: 4.1.1
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-->
<project name="mapping" default="run">
    <property name="example" value="mapping"/>
    <import file="../build.xml"/>

    <!-- when we clean, also remove all of the auto-generated files -->
    <target name="pre-clean" description="Pre-clean phase">
        <delete includeemptydirs="true">
            <fileset dir="${basedir}">
                <include name="create.sql"/>
                <include name="createUTF8.sql"/>
                <include name="schema.xml"/>
            </fileset>
        </delete>
    </target>

    <!--
        Run the mapping tool
    -->
    <target name="run" depends="compile"
            unless="mapping-schema-skip"
            description="Generate SQL DDL files">

        <taskdef name="mappingtool" classpathref="classpath"
            classname="org.apache.openjpa.jdbc.ant.MappingToolTask"/>

        <!-- This can also be performed from a cmdline as -
          java -cp .:openjpa-all-<version>.jar:derby-10.8.2.2.jar
          -Dopenjpa.ConnectionDriverName="org.apache.derby.jdbc.EmbeddedDriver"
          -Dopenjpa.ConnectionURL="jdbc:derby:mapping-database;create=true"
          -Dopenjpa.ConnectionUserName=  -Dopenjpa.ConnectionPassword=
          org.apache.openjpa.jdbc.meta.MappingTool BuildSchemaPC.class
          -a buildSchema
        -->
        <echo message="Using MappingTool to generate the XML schema"/>
        <mappingtool action="buildSchema"
            schemafile="schema.xml">
            <fileset dir="${basedir}">
                <include name="${basedir}/**/*.class"/>
            </fileset>
            <config connectiondrivername="${dbdriver}" connectionurl="${dburl}"
                connectionusername="${dbuser}" connectionpassword="${dbpass}"/>
        </mappingtool>

        <!-- This can also be performed from a cmdline as -
          java -cp .:openjpa-all-<version>.jar:derby-10.8.2.2.jar
          -Dopenjpa.ConnectionDriverName="org.apache.derby.jdbc.EmbeddedDriver"
          -Dopenjpa.ConnectionURL="jdbc:derby:mapping-database;create=true"
          -Dopenjpa.ConnectionUserName=  -Dopenjpa.ConnectionPassword=
          org.apache.openjpa.jdbc.meta.MappingTool BuildUTF8SchemaPC.class
          -sa build -sql createUTF8.sql -se UTF-8
        -->
        <echo message="Using MappingTool to generate the UTF-8 SQL DDL"/>
        <mappingtool schemaaction="build"
            sqlfile="createUTF8.sql" sqlEncode="UTF-8">
            <fileset dir="${basedir}">
                <include name="${basedir}/**/*.class"/>
            </fileset>
            <config connectiondrivername="${dbdriver}" connectionurl="${dburl}"
                connectionusername="${dbuser}" connectionpassword="${dbpass}"/>
        </mappingtool>

        <!-- This can also be performed from a cmdline as -
          java -cp .:openjpa-all-<version>.jar:derby-10.8.2.2.jar
          -Dopenjpa.ConnectionDriverName="org.apache.derby.jdbc.EmbeddedDriver"
          -Dopenjpa.ConnectionURL="jdbc:derby:mapping-database;create=true"
          -Dopenjpa.ConnectionUserName=  -Dopenjpa.ConnectionPassword=
          org.apache.openjpa.jdbc.meta.MappingTool BuildSchemaPC.class
          -sa build -sql create.sql
        -->
        <echo message="Using MappingTool to generate the SQL DDL"/>
        <mappingtool schemaaction="build"
            sqlfile="create.sql">
            <fileset dir="${basedir}">
                <include name="${basedir}/**/*.class"/>
            </fileset>
            <config connectiondrivername="${dbdriver}" connectionurl="${dburl}"
                connectionusername="${dbuser}" connectionpassword="${dbpass}"/>
        </mappingtool>
    </target>
</project>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy