|
RE: Using torque-gen from a java program: msg#00096jakarta.turbine.torque.user
Hi, Thank you very much. It worked that way (i had tried the ant docs, but they are a little confuse when trying to use ant from a Java file). I'll put my result here in the event that someone has the same need that I had: import org.apache.tools.ant.Main; ... String[] commands = new String[]{"-f", "build-torque.xml", "sql"}; Main m = new Main(); m.startAnt(commands, null, null); and ant.jar as well as ant-launcher.jar must be on your classpath. Hope it's usefull. -----Mensagem original----- De: Thomas Fischer [mailto:Fischer@xxxxxxxxxxxxx] Enviada: terça-feira, 16 de Novembro de 2004 8:58 Para: pfc@xxxxxxxxxx Cc: Apache Torque Users List Assunto: RE: Using torque-gen from a java program Hi, I believe it should not be a problem to call ant from a java program. As ant itself is a java program, you just have to put the ant libraries in your classpath, call the correct main class, and use the values which you would issue from the command line in the String[]argument of the main class. Look at ant.bat to see what it does (you might have to set the system properties "by hand") Perhaps there is an easier way to do it, it might be worth while to check the ant docs. Thomas "Pedro Castro" <pfc@xxxxxxxxxx> schrieb am 15.11.2004 20:12:04: > Hi, and thank you for your response. > > I could put version 3.1.1 working with ant in the command line ... I just > copied over my build.xml from 3.1 and run the usual way: ant -f build.xml > sql ... The problem is that I wanted to integrate it in a java project and i > didn't want to use the command line. > > > :) > > Pedro Castro. > > -----Mensagem original----- > De: Thomas Fischer [mailto:Fischer@xxxxxxxxxxxxx] > Enviada: segunda-feira, 15 de Novembro de 2004 18:52 > Para: Apache Torque Users List > Assunto: Re: Using torque > > > > > > Hi, > > please look at the tutorial, > http://db.apache.org/torque/tutorial/index.html. There, maven is used to > generate the java classes. It worked for me. > I did the following: > - downloaded and installed maven > - installed the torque plugin for maven (see tutorial) > - downloaded torque-gen-3.1.1 > - unpacked it and changed into the torque-gen-3.1.1 directory > - create a subdirectory src/schema and put the schema.xml from the tutorial > there > - put the torque.properties and build.properties from the tutorial directly > into the torque-gen-3.1.1 directory > - ran the command "maven torque" in the torque-gen-3.1.1 directory > - and voila, the java sources were generated in the src/java subdiretory. > > In the 3.1. version, there was also an ant file in the generator called > build-torque.xml, but I cannot find it in the 3.1.1 binary distribution :-( > I am not sure whether it was taken out by purpose, and if yes, why. So it > seems that using ant is not an option at the moment with torque 3.1.1 > > Thomas > > "Pedro Castro" <pfc@xxxxxxxxxx> schrieb am 15.11.2004 18:56:12: > > > Hello. > > > > > > > > I would like to use the 3.1.1 version of torque generator. > > > > > > > > I downloaded torque-gen-3.1.1.zip and ended up with the torque jar and > the > > lib dir containing the needed files (ant jar is included). > > > > > > > > I have project-schema.xml from my latest test as well as the > > build-torque.xml and build.properties. > > > > > > > > I want to make a new JAVA file using torque jar for generating the sql > > script, I understand that ant is needed. > > > > > > > > Is this possible, has anyone accomplished this? > > > > > > > > > > > > Thank you in advance. > > > > > > > > > > > > Pedro Castro. > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@xxxxxxxxxxxxx > For additional commands, e-mail: torque-user-help@xxxxxxxxxxxxx > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@xxxxxxxxxxxxx > For additional commands, e-mail: torque-user-help@xxxxxxxxxxxxx > --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@xxxxxxxxxxxxx For additional commands, e-mail: torque-user-help@xxxxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Antwort: Re: Subtracting fields in the Where Clause: 00096, Ruy Diaz Jara |
|---|---|
| Next by Date: | torque failing within junit "no DataSourceFactory configured": 00096, Angela Day |
| Previous by Thread: | RE: Using torque-gen from a java programi: 00096, Thomas Fischer |
| Next by Thread: | Antwort: Re: Subtracting fields in the Where Clause: 00096, arne . siegel |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |