I would like to execute torque from java instead of an xterm by ant.
I created build.properties and project-schema.xml
I tried :

TorqueSQLTask torqueSQLTask=new TorqueSQLTask();
torqueSQLTask.setContextProperties(new File(torqueHome + File.separator 
+ "build.properties"));
torqueSQLTask.setTemplatePath(new 
File(torqueHome+File.separator+"templates"));
torqueSQLTask.setOutputDirectory(new 
File(torqueHome+File.separator+"src"+File.separator+"sql"));
torqueSQLTask.setOutputFile(prefs.getDatabaseName()+"-schema.sql");
String str=torqueHome + File.separator + "schema" + File.separator+ 
prefs.getDatabaseName() + "-schema.xml";
torqueSQLTask.setXmlFile(str);
torqueSQLTask.setTargetDatabase(prefs.getDatabaseType());
try {
    torqueSQLTask.initControlContext();
    torqueSQLTask.execute();
   } catch (Exception e) {
   System.out.println( e);
   }

I got :
java.lang.NullPointerException
        at 
org.apache.torque.task.TorqueDataModelTask.setXmlFile(TorqueDataModelTask.java:211)
...

Can you help me to execute the TorqueSQLTask  ?
Have you help about starting any ant task from a class ?

Best Regards.

Emmanuel Florent
[EMAIL PROTECTED]
http://www.devaki.org

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to