db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From EP...@upstate.com
Subject RE: how to call TorqueSQLTask from other program/java class?
Date Wed, 18 Dec 2002 18:56:48 GMT
Look at the ant documentation (jakarta.apache.org/ant) on how to call ant
from Java.  That is probably the easiest way to run Ant style tasks.

Eric Pugh

-----Original Message-----
From: tek1 [mailto:tek1@pobox.com]
Sent: Wednesday, December 18, 2002 2:05 PM
To: turbine-torque-user@jakarta.apache.org
Subject: how to call TorqueSQLTask from other program/java class?


hello.

i'm trying to call the TorqueSQLTask from my program and tried the
following:



     private void generateSql() throws AnException
     {

         try {
             TorqueSQLTask task = new TorqueSQLTask();

             task.setBasePathToDbProps("sql/base/");
             task.setControlTemplate("sql/base/Control.vm");
             task.setIdTableXMLFile("sql/id-table/Control.vm");
             task.setOutputDirectory(new File("projectBaseDir/out"));
             task.setOutputFile("report.sql.generation");
             //task.setSqlDbMap("projectBaseDir/out/sqldb.map");
             task.setUseClasspath(true);
             task.setTargetDatabase("postgresql");

             // set the db-schema.xml file as the only file in the fileset
to process
             FileSet fileset = new FileSet();

             fileset.setDir(this.getDestDir());
             fileset.setIncludes("db-schema.xml");
             task.addFileset(fileset);

             task.initControlContext();

             task.execute();

         }
         catch (BuildException e) {
             throw new AnException(e.getMessage());
	}  catch (Exception e) {
             throw new AnException(e.getMessage());
         }
     }


however, the task execution is failing, but no detailed information is 
being provided.  no velocity.log was generated.  torque-3.0.jar, 
velocity-1.3.jar, and the torque "templates" directory are all on the
classpath.

is the above the correct way to call the TorqueSQLTask from another 
program?  is a sample available?

thank you. 


--
To unsubscribe, e-mail:
<mailto:turbine-torque-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:turbine-torque-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message