db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "svallet" <sval...@t-systems.fr>
Subject Using SQLTask from Java -- No more double Pass Error ???
Date Mon, 05 May 2003 15:02:30 GMT
Hi,

after some homework, I was able to get the Torque tasks running from Java.
But I still have problems using the SQLExecTask -- the following code :


TorqueSQLTask genSQLTask = new TorqueSQLTask();

genSQLTask.setProject(new Project());
genSQLTask.setUseClasspath(genProps.getProperty("useClasspath").equals("true
"));
genSQLTask.setControlTemplate(TORQUE_CONTROL_TEMPLATE);
genSQLTask.setOutputDirectory(new
File(genProps.getProperty("sqlOutputDir")));

genSQLTask.setOutputFile(schema+genProps.getProperty("sqlFileSuffix"));
genSQLTask.setTargetDatabase(dbProps.getProperty("sgbd"));

genSQLTask.setXmlFile(new File(schemaFile).getPath());
genSQLTask.setIdTableXMLFile(ID_TABLE_XML_FILE);
genSQLTask.setSqlDbMap(SQL_DB_MAP);

genSQLTask.initControlContext();
genSQLTask.execute();


throws an Error when trying to load the idbroker Model : it says
java.lang.Error: No more double pass
at
org.apache.torque.engine.database.transform.XmlToAppData.parseFile(XmlToAppD
ata.java:147) at
org.apache.torque.task.TorqueSQLTask.loadIdBrokerModel(TorqueSQLTask.java:20
6)
at
org.apache.torque.task.TorqueSQLTask.initControlContext(TorqueSQLTask.java:2
28)
...

If i remove the initControlContext() it does work (some SQL is generated),
but I don't get
the id table and the sqldbmap :(

What is this "No more double pass Error" ??
(oh, the source says : "// in case I am missing something, make it obvious")
What do I miss ??

Here is my id-table-schema :
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE database SYSTEM
"file:///D:/Users/svallet/catgen_base/xml/database.dtd">

<!--
==================================================================== -->
<!--                                                                      --
>
<!-- I D  B R O K E R  S C H E M
  -->
<!--                                                                      --
>
<!--
==================================================================== -->
<!-- This is the XML schema use by Torque to generate the SQL
    -->
<!-- ID_TABLE table used by the id broker mechanism in
         -->
<!--
==================================================================== -->
<!-- @author: <a href="mailto:jvanzyl@apache.org">Jason van
>       -->
<!-- @version $Id: id-table-schema.xml,v 1.5 2002/02/18 19:55:53 jon Exp
$ -->
<!--
==================================================================== -->

<database name="catgen2">
  <table name="ID_TABLE" idMethod="idbroker">
    <column name="ID_TABLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
    <column name="TABLE_NAME" required="true" size="255" type="VARCHAR"/>
    <column name="NEXT_ID" type="INTEGER"/>
    <column name="QUANTITY" type="INTEGER"/>
    <unique>
      <unique-column name="TABLE_NAME"/>
    </unique>
  </table>
</database>


Hope I'm not missing something obvious...


Any suggestions are welcome,
Simon

--
Simon Vallet
T-Systems e-technologies
svallet@t-systems.fr


Mime
View raw message