On Wednesday 31 July 2002 4:11 pm, Stephen Haberman wrote:
> If you still get the error, let us know, and attach any schemas you have
> in your schema directory.
OK, I forgot to do this in my last post. So see attached files.
<project name="bookstore" default="main" basedir=".">
<property name="torque.home" value="."/>
<property name="build.properties" value="bookstore.build.properties"/>
<property file="${build.properties}"/>
<property name="lib.dir" value="lib"/>
<property name="idTableXMLFile" value=""/>
<!-- Build classpath -->
<path id="torque-classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!--
Do forward declarations of all of our tasks to
centralize them and clean up the targets.
-->
<taskdef
name="torque-data-model"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueDataModelTask"/>
<taskdef
name="torque-data-dump"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueDataDumpTask"/>
<taskdef
name="torque-data-sql"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueDataSQLTask"/>
<taskdef
name="torque-doc"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueDocumentationTask"/>
<taskdef
name="torque-jdbc-transform"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueJDBCTransformTask"/>
<taskdef
name="torque-sql"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueSQLTask"/>
<taskdef
name="torque-sql-exec"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueSQLExec"/>
<taskdef
name="torque-sql-transform"
classpathref="torque-classpath"
classname="org.apache.torque.task.TorqueSQLTransformTask"/>
<!-- ================================================================ -->
<!-- M A I N T A R G E T -->
<!-- ================================================================ -->
<!-- This default target will run all the targets that generate -->
<!-- source. You will probably only run this target once then -->
<!-- call individual targets as necessary to update your sources -->
<!-- when you change your XML schema. -->
<!-- ================================================================ -->
<target
name="main"
description="==> generates sql + om classes">
<antcall target="sql"/>
<antcall target="om"/>
</target>
<!-- ================================================================ -->
<!-- C H E C K U S E C L A S S P A T H -->
<!-- ================================================================ -->
<!-- Temporary Hack around the propertiesUtil bug. Should be fixed -->
<!-- soon. -->
<!-- ================================================================ -->
<target name="check-use-classpath">
<condition property="torque.internal.useClasspath">
<equals arg1="${torque.useClasspath}" arg2="true"/>
</condition>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T S Q L -->
<!-- ================================================================ -->
<!-- Generate the SQL for your project, these are in addition -->
<!-- to the base Turbine tables! The tables you require for your -->
<!-- project should be specified in project-schema.xml. -->
<!-- ================================================================ -->
<target
name="sql"
depends="check-use-classpath"
description="==> generates the SQL for your project">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL for YOUR Turbine project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<antcall target="sql-classpath"/>
<antcall target="sql-template"/>
</target>
<target
name="sql-classpath"
if="torque.internal.useClasspath">
<echo message="using classpath"/>
<torque-sql
contextProperties="${build.properties}"
controlTemplate="${SQLControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/sql"
useClasspath="${useClasspath}"
basePathToDbProps="sql/base/"
sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
outputFile="report.${project}.sql.generation"
targetDatabase="${database}"
idTableXMLFile="${idTableXMLFile}">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-sql>
</target>
<target
name="sql-template"
unless="torque.internal.useClasspath">
<echo message="using template path ${templatePath}"/>
<torque-sql
contextProperties="${build.properties}"
controlTemplate="${SQLControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/sql"
templatePath="${templatePath}"
basePathToDbProps="sql/base/"
sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
outputFile="report.${project}.sql.generation"
targetDatabase="${database}"
idTableXMLFile="${idTableXMLFile}">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-sql>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E D O C S -->
<!-- ================================================================ -->
<target
name="doc"
description="==> generates documentation for your datamodel">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating docs for YOUR datamodel! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-doc
contextProperties="${build.properties}"
controlTemplate="${DocControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/doc"
useClasspath="${useClasspath}"
outputFormat="${documentationFormat}"
templatePath="${templatePath}"
sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
outputFile="report.${project}.doc.generation">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-doc>
</target>
<!-- ================================================================ -->
<!-- C R E A T E T A R G E T D A T A B A S E -->
<!-- ================================================================ -->
<!-- Create the target database by executing a generated script -->
<!-- that is capable of performing the task. -->
<!-- ================================================================ -->
<target
name="create-db"
unless="database.manual.creation"
description="==> generates the target database">
<torque-data-model
controlTemplate="sql/db-init/Control.vm"
outputDirectory="${torque.home}/${outputDirectory}/sql"
useClasspath="${useClasspath}"
targetDatabase="${database}"
templatePath="${templatePath}"
outputFile="create-db.sql">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-data-model>
<echo>
Executing the create-db.sql script ...
</echo>
<sql
driver="${databaseDriver}"
url="${createDatabaseUrl}"
userid="${databaseUser}"
password="${databasePassword}"
src="${torque.home}/${outputDirectory}/sql/create-db.sql"
autocommit="true"
onerror="continue">
<classpath refid="torque-classpath"/>
</sql>
</target>
<!-- ================================================================ -->
<!-- I N S E R T S I N G L E S Q L F I L E S -->
<!-- ================================================================ -->
<target
name="insert-sql">
<torque-sql-exec
driver="${databaseDriver}"
url="${buildDatabaseUrl}"
userid="${databaseUser}"
password="${databasePassword}"
autocommit="true"
onerror="continue"
sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
srcDir="${torque.home}/${outputDirectory}/sql">
<classpath refid="torque-classpath"/>
</torque-sql-exec>
</target>
<!-- ================================================================ -->
<!-- J D B C TO X M L -->
<!-- ================================================================ -->
<target
name="jdbc"
description="==> jdbc to xml">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating XML from JDBC connection ! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${build.properties}"/>
<torque-jdbc-transform
dbUrl="${databaseUrl}"
dbDriver="${databaseDriver}"
dbUser="${databaseUser}"
dbPassword="${databasePassword}"
dbSchema="${databaseSchema}"
outputFile="${torque.home}/${outputDirectory}/schema.xml"
sameJavaName="${sameJavaName}"
/>
</target>
<!-- ================================================================ -->
<!-- Generate SQL from XML data file -->
<!-- ================================================================ -->
<target
name="datasql"
description="==> generates sql from data xml">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL from data XML ! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${build.properties}"/>
<torque-data-sql
contextProperties="${build.properties}"
controlTemplate="${DataSQLControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}"
useClasspath="${useClasspath}"
templatePath="${templatePath}"
outputFile="${project}-data.sql"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
dataXmlFile="${torque.home}/${schemaDirectory}/${project}-data.xml"
dataDTD="${torque.home}/${schemaDirectory}/${project}-data.dtd"
targetDatabase="${database}"
sqldbmap="${basedir}/${outputDirectory}/sql/sqldb.map"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E I D B R O K E R I N I T S Q L -->
<!-- ================================================================ -->
<target
name="id-table-init-sql">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating initialization SQL |"/>
<echo message="| for ID Broker system! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-sql
contextProperties="${build.properties}"
controlTemplate="${idTableControlTemplate}"
suffix="-idtable-init"
sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
outputDirectory="${torque.home}/${outputDirectory}/sql"
useClasspath="${useClasspath}"
templatePath="${templatePath}"
outputFile="${database}-id-table-init.sql"
targetDatabase="${database}">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
</torque-sql>
</target>
<!-- ================================================================ -->
<!-- Dump data from database into xml file -->
<!-- ================================================================ -->
<target
name="datadump"
description="==> dump data from database into xml file">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Dumping the data from database into XML |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${build.properties}"/>
<torque-data-dump
contextProperties="${build.properties}"
controlTemplate="${DataDumpControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}"
useClasspath="${useClasspath}"
templatePath="${templatePath}"
outputFile="report.${project}.datadump.generation"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
databaseDriver="${databaseDriver}"
databaseUrl="${databaseUrl}"
databaseUser="${databaseUser}"
databasePassword="${databasePassword}"
databaseName="${databaseName}"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T D A T A D T D -->
<!-- ================================================================ -->
<!-- Generate the DATA DTD for your project -->
<!-- ================================================================ -->
<target
name="datadtd"
description="==> generates the DATA DTD for your project">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Data DTD for YOUR Turbine project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<torque-data-model
contextProperties="${build.properties}"
controlTemplate="${DataDTDControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}"
useClasspath="${useClasspath}"
templatePath="${templatePath}"
outputFile="report.${project}.datadtd.generation"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T P E E R B A S E D O M -->
<!-- ================================================================ -->
<!-- Generate the Peer-based object model for your project. -->
<!-- These are in addition to the base Turbine OM! -->
<!-- ================================================================ -->
<target
name="om"
depends="check-use-classpath"
description="==> generates the Peer-based object model for your project">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Peer-based Object Model for |"/>
<echo message="| YOUR Turbine project! Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<antcall target="om-classpath"/>
<antcall target="om-template"/>
</target>
<target
name="om-classpath"
if="torque.internal.useClasspath">
<echo message="using classpath"/>
<torque-data-model
contextProperties="${build.properties}"
controlTemplate="${OMControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/java"
useClasspath="${useClasspath}"
outputFile="report.${project}.om.generation"
targetPackage="${targetPackage}"
targetDatabase="${database}">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
</torque-data-model>
</target>
<target
name="om-template"
unless="torque.internal.useClasspath">
<echo message="using template path ${templatePath}"/>
<torque-data-model
contextProperties="${build.properties}"
controlTemplate="${OMControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/java"
templatePath="${templatePath}"
outputFile="report.${project}.om.generation"
targetPackage="${targetPackage}"
targetDatabase="${database}">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
<exclude name="id-table-schema.xml"/>
</fileset>
</torque-data-model>
</target>
<!-- =================================================================== -->
<!-- C O M P I L E O M -->
<!-- =================================================================== -->
<target
name="compile"
description="==> compiles the OM classes">
<!--
This should be moved to the top of the file, and
the values should come from the build.properties file.
-->
<property name="src.dir" value="${outputDirectory}/java"/>
<property name="build.dest" value="bin/classes"/>
<property name="debug" value="on"/>
<property name="deprecation" value="off"/>
<property name="optimize" value="off"/>
<mkdir dir="${build.dest}"/>
<javac srcdir="${src.dir}"
destdir="${build.dest}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}">
<classpath refid="torque-classpath"/>
</javac>
</target>
<!-- =================================================================== -->
<!-- S Q L T O X M L -->
<!-- =================================================================== -->
<!-- Create an xml schema from an sql schema. -->
<!-- -->
<!-- inputFile: The input sql file. This must be valid sql file but -->
<!-- it not not be in any specific format. -->
<!-- outputFile: The file where the xml schema will be written -->
<!-- =================================================================== -->
<target
name="sql2xml"
description="==> creates an xml schema from an sql schema">
<torque-sql-transform
inputFile="schema/schema.sql"
outputFile="schema/schema.xml"
/>
</target>
<!-- ================================================================== -->
<!-- J A V A D O C -->
<!-- ================================================================== -->
<target
name="javadocs"
description="==> generates the API documentation">
<mkdir dir="${torque.home}/${outputDirectory}/javadoc"/>
<javadoc
sourcepath="${torque.home}/${outputDirectory}/java"
packagenames="${targetPackage}.*"
destdir="${outputDirectory}/javadoc"
author="true"
private="true"
version="true"
use="true">
<classpath refid="torque-classpath"/>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- =================================================================== -->
<!-- O J B S T U F F -->
<!-- =================================================================== -->
<!-- =================================================================== -->
<target
name="ojb-repository">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating OJB repository |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-data-model
contextProperties="${build.properties}"
controlTemplate="ojb/repository/Control.vm"
targetPackage="${targetPackage}"
targetDatabase="${database}"
outputDirectory="${torque.home}/${outputDirectory}/ojb"
useClasspath="${useClasspath}"
templatePath="${templatePath}"
sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
outputFile="report.${project}.ojb.generation">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-data-model>
</target>
<target
name="ojb-model">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating OJB model |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-data-model
contextProperties="${build.properties}"
controlTemplate="ojb/model/Control.vm"
targetPackage="${targetPackage}"
targetDatabase="${database}"
outputDirectory="${torque.home}/${outputDirectory}/ojb"
useClasspath="${useClasspath}"
templatePath="${templatePath}"
sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
outputFile="report.${project}.ojb.generation">
<fileset dir="${torque.home}/${schemaDirectory}">
<include name="*-schema.xml"/>
</fileset>
</torque-data-model>
</target>
<!--
Deprecated targets with the project- prefix.
-->
<target name="project-sql">
<echo message="The 'project-sql' target is deprecated. Please use the 'sql' target instead."/>
<antcall target="sql"/>
</target>
<target name="project-om">
<echo message="The 'project-om' target is deprecated. Please use the 'om' target instead."/>
<antcall target="om"/>
</target>
<target name="project-doc">
<echo message="The 'project-doc' target is deprecated. Please use the 'doc' target instead."/>
<antcall target="doc"/>
</target>
<target name="project-create-db">
<echo message="The 'project-create-db' target is deprecated. Please use the 'create-db' target instead."/>
<antcall target="create-db"/>
</target>
<target name="project-insert-sql">
<echo message="The 'project-insert-sql' target is deprecated. Please use the 'insert-sql' target instead."/>
<antcall target="insert-sql"/>
</target>
<target name="project-jdbc">
<echo message="The 'project-jdbc' target is deprecated. Please use the 'jdbc' target instead."/>
<antcall target="jdbc"/>
</target>
<target name="project-datasql">
<echo message="The 'project-datasql' target is deprecated. Please use the 'datasql' target instead."/>
<antcall target="datasql"/>
</target>
<target name="project-datadump">
<echo message="The 'project-datadump' target is deprecated. Please use the 'datadump' target instead."/>
<antcall target="datadump"/>
</target>
<target name="project-datadtd">
<echo message="The 'project-datadtd' target is deprecated. Please use the 'datadtd' target instead."/>
<antcall target="datadtd"/>
</target>
<target name="project-sql2xml">
<echo message="The 'project-sql2xml' target is deprecated. Please use the 'sql2xml' target instead."/>
<antcall target="sql2xml"/>
</target>
<target name="project-ojb-repository">
<echo message="The 'project-ojb-repository' target is deprecated. Please use the 'ojb-repository' target instead."/>
<antcall target="ojb-repository"/>
</target>
<target name="project-ojb-model">
<echo message="The 'project-obj-model' target is deprecated. Please use the 'ojb-model' target instead."/>
<antcall target="ojb-model"/>
</target>
</project>
# -------------------------------------------------------------------
#
# T O R Q U E C O N F I G U R A T I O N F I L E
#
# -------------------------------------------------------------------
# -------------------------------------------------------------------
#
# T U R B I N E P R O J E C T
#
# -------------------------------------------------------------------
# This is the name of your Turbine project. Your generated sources
# will be named using the project name selected below. If your
# project=killerapp then you will have a generated:
#
# killerapp-schema.sql
#
# IMPORTANT!
# This means that your project schema MUST be named
# killerapp-schema.xml and it MUST be placed in the
# schema directory for Torque to work property.
#
# The object model sources generated are independent of
# the project name selected.
# -------------------------------------------------------------------
project = bookstore
targetPackage = net.pjwc.torque.bookstore.om
# -------------------------------------------------------------------
#
# T A R G E T D A T A B A S E
#
# -------------------------------------------------------------------
# This is the target database, only considered when generating
# the SQL for your Turbine project. Your possible choices are
#
# db2
# db2400
# hypersonic
# mysql
# oracle
# postgresql
# mssql
#
# Default: none
# -------------------------------------------------------------------
database = postgresql
# -------------------------------------------------------------------
#
# O B J E C T M O D E L I N F O R M A T I O N
#
# -------------------------------------------------------------------
# These settings will allow you to customize the way your
# Peer-based object model is created.
# -------------------------------------------------------------------
# addSaveMethod=true adds tracking code to determine how to save objects
#
# addGetByNameMethod=true adds methods to get fields by name/position
#
# complexObjectModel=true generates an om with collection support
#
# addTimeStamp=true puts time stamps in generated files
#
# addIntakeRetrievable=implement Intake's Retrievable interface
#
# useManagers=Generate Manager classes that use JCS for caching. Still
# considered experimental.
#
# useClasspath=true uses Velocity's classpath loader to retrieve the templates
# from the classpath instead of off the hard drive.
#
# overloadKeySetters=false prevents overloading of the setter method for
# primary/foreign keys. This is useful when working with broken
# JavaBean implementations.
# -------------------------------------------------------------------
targetPackage=org.apache.torque
basePrefix=Base
addSaveMethod=true
addGetByNameMethod=true
complexObjectModel=true
addTimeStamp=true
addIntakeRetrievable=false
useManagers=false
overloadKeySetters=true
useClasspath=false
# -------------------------------------------------------------------
#
# D A T A B A S E S E T T I N G S
#
# -------------------------------------------------------------------
# JDBC connection settings. This is used by the JDBCToXML task that
# will create an XML database schema from JDBC metadata. These
# settings are also used by the SQL Ant task to initialize your
# Turbine system with the generated SQL.
# -------------------------------------------------------------------
createDatabaseUrl = jdbc:postgresql://127.0.0.1:5432/template1
buildDatabaseUrl = jdbc:postgresql://127.0.0.1:5432/bookstore
databaseUrl = jdbc:postgresql://127.0.0.1:5432/bookstore
databaseDriver = org.postgresql.Driver
databaseUser = pete
databasePassword = pete
databaseHost = 127.0.0.1
# Tells JDBC task that javaName attribute for the tables and columns
# should be made same as SQL name.
#sameJavaName=false
# -------------------------------------------------------------------
#
# D O C U M E N T A T I O N S E T T I N G S
#
# -------------------------------------------------------------------
# These settings will allow you to customize the way your schema
# documentation is created.
# Valid formats are: html, anakia (for use with jakarta-site2)
# -------------------------------------------------------------------
documentationFormat=html
# -------------------------------------------------------------------
# You should NOT have to edit anything below here.
# -------------------------------------------------------------------
# -------------------------------------------------------------------------
# The values for the ID_TABLE_ID column in the ID_TABLE start
# at 101 for tables used in projects.
# -------------------------------------------------------------------------
initialID = 101
# -------------------------------------------------------------------
#
# T E M P L A T E P A T H
#
# -------------------------------------------------------------------
templatePath = templates
# -------------------------------------------------------------------
#
# C O N T R O L T E M P L A T E S
#
# -------------------------------------------------------------------
SQLControlTemplate = sql/base/Control.vm
OMControlTemplate = om/Control.vm
idTableControlTemplate = sql/id-table/Control.vm
DataDTDControlTemplate = data/Control.vm
DataDumpControlTemplate = data/dump/Control.vm
DataSQLControlTemplate = sql/load/Control.vm
DocControlTemplate = doc/Control.vm
# -------------------------------------------------------------------
#
# O U T P U T D I R E C T O R Y
#
# -------------------------------------------------------------------
outputDirectory=src
# -------------------------------------------------------------------
#
# S C H E M A D I R E C T O R Y
#
# -------------------------------------------------------------------
schemaDirectory=schema
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>