db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tek1 <t...@pobox.com>
Subject how to call TorqueSQLTask from other program/java class?
Date Tue, 17 Dec 2002 15:09:16 GMT
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. 


Mime
View raw message