Zhao, John
2004-10-25 08:43:02 UTC
Hi all,
Could anybody know what else do I need to set to have Middlegen works
with the table relationships (Swing GUI not show any relationship). I
just tested out with Oracle9i Scott/Tiger as:
<?xml version="1.0"?>
<!-- ===================================================================
-->
<!-- Fails if XDoclet 1.2.x is not on classpath
-->
<!-- ===================================================================
-->
<project name="test" default="init" basedir=".">
<property file="${user.home}/build.properties"/>
<property file="${basedir}/build.properties"/>
<property name="middlegen.home"
value="${basedir}/.."/>
<property name="xdoclet.version" value="1.2"/>
<property name="name" value="airline"/>
<!-- This was added because we were several people (in a course)
deploying to same app server>
<property environment="env"/>
<property name="unique.name"
value="${name}.${env.COMPUTERNAME}"/-->
<property name="unique.name" value="${name}"/>
<property name="appxml.src.file"
value="${basedir}/src/application.xml"/>
<property name="lib.dir"
value="${basedir}/lib"/>
<property name="src.dir"
value="${basedir}/src"/>
<property name="java.src.dir"
value="${src.dir}/java"/>
<property name="web.src.dir"
value="${src.dir}/web"/>
<property name="build.dir"
value="${basedir}/build"/>
<property name="build.java.dir"
value="${build.dir}/java"/>
<property name="build.gen-src.dir"
value="${build.dir}/gen-src"/>
<property name="build.gen-webui.dir"
value="${build.dir}/gen-webui"/>
<property name="build.classes.dir"
value="${build.dir}/classes"/>
<property name="build.ejb-meta.dir"
value="${build.dir}/ejb-meta"/>
<property name="build.web-meta.dir"
value="${build.dir}/web-meta"/>
<property name="build.gen-torque-schema.dir"
value="${build.dir}/torque"/>
<property name="build.gen-torque-conf.dir"
value="${build.dir}/torque-conf"/>
<property name="ear.dir"
value="${build.dir}/ear"/>
<property name="ear.file"
value="${ear.dir}/${unique.name}.ear"/>
<property name="ear.meta.dir"
value="${build.dir}/ear-meta"/>
<property name="ejb.dir"
value="${build.dir}/ejb"/>
<property name="ejb.jar.file"
value="${ejb.dir}/${unique.name}-ejb.jar"/>
<property name="build.sar-meta.dir"
value="${build.dir}/sar-meta"/>
<property name="build.sar.dir"
value="${build.dir}/sar"/>
<property name="sar.file"
value="${build.sar.dir}/${unique.name}-hibernate.sar"/>
<property name="war.dir"
value="${build.dir}/war"/>
<property name="war.file"
value="${war.dir}/${unique.name}-web.war"/>
<property name="build.html.dir"
value="${build.dir}/html"/>
<property name="build.jdo.dir"
value="${build.dir}/jdo"/>
<property name="build.xmi.dir"
value="${build.dir}/xmi"/>
<property name="actionlayer.plugin" value="struts"/>
<property name="persistencelayer.plugin" value="cmp20"/>
<!--
-->
<property file="${basedir}/build.properties"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="build.gen-src.dir"
value="${build.dir}/gen-src"/>
<property name="database.driver.file"
value="${lib.dir}/classes12.jar"/>
<property name="database.driver.classpath"
value="${database.driver.file}"/>
<property name="database.driver"
value="oracle.jdbc.driver.OracleDriver" />
<property name="database.url"
value="jdbc:oracle:thin:@hxddba01:1521:mp9u" />
<property name="database.userid"
value="scott"/>
<property name="database.password"
value="tiger"/>
<property name="database.schema"
value="SCOTT"/>
<!-- ===================================================================
-->
<!-- Fails if XDoclet 1.2.x is not on classpath
-->
<!-- ===================================================================
-->
<path id="lib.class.path">
<pathelement path="${basedir}"/>
<pathelement path="${database.driver.classpath}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<!-- The middlegen jars -->
<fileset dir="${middlegen.home}">
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${build.classes.dir}"/>
</target>
<!--
=================================================================== -->
<!-- Run Middlegen
-->
<!--
=================================================================== -->
<target
name="middlegen"
description="Run Middlegen"
unless="middlegen.skip"
<!--
depends="init,fail-if-no-xdoclet-1.2,check-driver-present,panic-if-drive
r-not-present"
-->
<mkdir dir="${build.gen-src.dir}"/>
<taskdef
name="middlegen"
classname="middlegen.MiddlegenTask"
classpathref="lib.class.path"
/>
<middlegen
appname="${name}"
prefsdir="${src.dir}"
gui="${gui}"
databaseurl="${database.url}"
initialContextFactory="${java.naming.factory.initial}"
providerURL="${java.naming.provider.url}"
datasourceJNDIName="${datasource.jndi.name}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}"
<html destination="${build.html.dir}">
<!--
We can override the plugin's templates
by specifying the id of the original template
and providing a new one from the file system.
Uncomment the line below to see it in action.
(This technique can be used for all plugins).
-->
<!--fileproducer
id="single-table"
template="${basedir}/src/templates/single-table.vm"
/-->
</html>
<hibernate
destination="${build.gen-src.dir}"
package="${name}.hibernate"
genXDocletTags="true"
/>
</middlegen>
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="hbm2java" description="Generate .java from .hbm
files.">
<taskdef
name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="lib.class.path"
/>
<hbm2java output="${build.gen-src.dir}">
<fileset dir="${build.gen-src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>
</project>
My Ant output always complains:
: Middlegen couldn't find any relations between any tables. This may be
intentio
nal from the design of the database, but it may also be because you have
incorre
ctly defined the relationships. It could also be because the JDBC driver
you're
using doesn't correctly implement DatabaseMetaData. See the samples (for
an exam
ple on how to define relationships) and verify that your driver
correctly implem
ents DatabaseMetaData.
Anybody now why?
Thanks in advance!
John
***@amfam.com
Could anybody know what else do I need to set to have Middlegen works
with the table relationships (Swing GUI not show any relationship). I
just tested out with Oracle9i Scott/Tiger as:
<?xml version="1.0"?>
<!-- ===================================================================
-->
<!-- Fails if XDoclet 1.2.x is not on classpath
-->
<!-- ===================================================================
-->
<project name="test" default="init" basedir=".">
<property file="${user.home}/build.properties"/>
<property file="${basedir}/build.properties"/>
<property name="middlegen.home"
value="${basedir}/.."/>
<property name="xdoclet.version" value="1.2"/>
<property name="name" value="airline"/>
<!-- This was added because we were several people (in a course)
deploying to same app server>
<property environment="env"/>
<property name="unique.name"
value="${name}.${env.COMPUTERNAME}"/-->
<property name="unique.name" value="${name}"/>
<property name="appxml.src.file"
value="${basedir}/src/application.xml"/>
<property name="lib.dir"
value="${basedir}/lib"/>
<property name="src.dir"
value="${basedir}/src"/>
<property name="java.src.dir"
value="${src.dir}/java"/>
<property name="web.src.dir"
value="${src.dir}/web"/>
<property name="build.dir"
value="${basedir}/build"/>
<property name="build.java.dir"
value="${build.dir}/java"/>
<property name="build.gen-src.dir"
value="${build.dir}/gen-src"/>
<property name="build.gen-webui.dir"
value="${build.dir}/gen-webui"/>
<property name="build.classes.dir"
value="${build.dir}/classes"/>
<property name="build.ejb-meta.dir"
value="${build.dir}/ejb-meta"/>
<property name="build.web-meta.dir"
value="${build.dir}/web-meta"/>
<property name="build.gen-torque-schema.dir"
value="${build.dir}/torque"/>
<property name="build.gen-torque-conf.dir"
value="${build.dir}/torque-conf"/>
<property name="ear.dir"
value="${build.dir}/ear"/>
<property name="ear.file"
value="${ear.dir}/${unique.name}.ear"/>
<property name="ear.meta.dir"
value="${build.dir}/ear-meta"/>
<property name="ejb.dir"
value="${build.dir}/ejb"/>
<property name="ejb.jar.file"
value="${ejb.dir}/${unique.name}-ejb.jar"/>
<property name="build.sar-meta.dir"
value="${build.dir}/sar-meta"/>
<property name="build.sar.dir"
value="${build.dir}/sar"/>
<property name="sar.file"
value="${build.sar.dir}/${unique.name}-hibernate.sar"/>
<property name="war.dir"
value="${build.dir}/war"/>
<property name="war.file"
value="${war.dir}/${unique.name}-web.war"/>
<property name="build.html.dir"
value="${build.dir}/html"/>
<property name="build.jdo.dir"
value="${build.dir}/jdo"/>
<property name="build.xmi.dir"
value="${build.dir}/xmi"/>
<property name="actionlayer.plugin" value="struts"/>
<property name="persistencelayer.plugin" value="cmp20"/>
<!--
-->
<property file="${basedir}/build.properties"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="build.gen-src.dir"
value="${build.dir}/gen-src"/>
<property name="database.driver.file"
value="${lib.dir}/classes12.jar"/>
<property name="database.driver.classpath"
value="${database.driver.file}"/>
<property name="database.driver"
value="oracle.jdbc.driver.OracleDriver" />
<property name="database.url"
value="jdbc:oracle:thin:@hxddba01:1521:mp9u" />
<property name="database.userid"
value="scott"/>
<property name="database.password"
value="tiger"/>
<property name="database.schema"
value="SCOTT"/>
<!-- ===================================================================
-->
<!-- Fails if XDoclet 1.2.x is not on classpath
-->
<!-- ===================================================================
-->
<path id="lib.class.path">
<pathelement path="${basedir}"/>
<pathelement path="${database.driver.classpath}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<!-- The middlegen jars -->
<fileset dir="${middlegen.home}">
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${build.classes.dir}"/>
</target>
<!--
=================================================================== -->
<!-- Run Middlegen
-->
<!--
=================================================================== -->
<target
name="middlegen"
description="Run Middlegen"
unless="middlegen.skip"
<!--
depends="init,fail-if-no-xdoclet-1.2,check-driver-present,panic-if-drive
r-not-present"
-->
<mkdir dir="${build.gen-src.dir}"/>
<taskdef
name="middlegen"
classname="middlegen.MiddlegenTask"
classpathref="lib.class.path"
/>
<middlegen
appname="${name}"
prefsdir="${src.dir}"
gui="${gui}"
databaseurl="${database.url}"
initialContextFactory="${java.naming.factory.initial}"
providerURL="${java.naming.provider.url}"
datasourceJNDIName="${datasource.jndi.name}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}"
<html destination="${build.html.dir}">
<!--
We can override the plugin's templates
by specifying the id of the original template
and providing a new one from the file system.
Uncomment the line below to see it in action.
(This technique can be used for all plugins).
-->
<!--fileproducer
id="single-table"
template="${basedir}/src/templates/single-table.vm"
/-->
</html>
<hibernate
destination="${build.gen-src.dir}"
package="${name}.hibernate"
genXDocletTags="true"
/>
</middlegen>
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="hbm2java" description="Generate .java from .hbm
files.">
<taskdef
name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="lib.class.path"
/>
<hbm2java output="${build.gen-src.dir}">
<fileset dir="${build.gen-src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>
</project>
My Ant output always complains:
: Middlegen couldn't find any relations between any tables. This may be
intentio
nal from the design of the database, but it may also be because you have
incorre
ctly defined the relationships. It could also be because the JDBC driver
you're
using doesn't correctly implement DatabaseMetaData. See the samples (for
an exam
ple on how to define relationships) and verify that your driver
correctly implem
ents DatabaseMetaData.
Anybody now why?
Thanks in advance!
John
***@amfam.com