Date: 2004-04-20T16:10:18 Editor: ScottEade <[EMAIL PROTECTED]> Wiki: DB Torque Wiki Page: FrequentlyAskedQuestions URL: http://wiki.apache.org/db-torque/FrequentlyAskedQuestions
Improved formatting. Change Log: ------------------------------------------------------------------------------ @@ -1,16 +1,17 @@ -Question: What is Village? +[[TableOfContents]] -Answer: See the [http://share.whichever.com/index.php?SCREEN=village Village] homepage for that information. ----- +== What is Village? == -Question: Torque uses Village 2.0. I can't find any reference to that version on the Village page. +'''Answer:''' See the [http://share.whichever.com/index.php?SCREEN=village Village] homepage for that information. -Answer: Village 2.0 has not been released. You can get the source by getting the latest CVS version. Instructions for doing this are on the [http://share.whichever.com/index.php?SCREEN=village Village] homepage. When you build the project, you will have a village-2.0-dev jar file. ----- +== Torque uses Village 2.0. I can't find any reference to that version on the Village page. == -Question: How can I configure Torque to use a JNDI connection +'''Answer:''' Village 2.0 has not been released. You can get the source by getting the latest CVS version. Instructions for doing this are on the [http://share.whichever.com/index.php?SCREEN=village Village] homepage. When you build the project, you will have a village-2.0-dev jar file. -Answer: Read the Torque Howto for indepth information. However, here is the short howto! * Torque.properties: +== How can I configure Torque to use a JNDI connection? == + +'''Answer:''' Read the Torque Howto for indepth information. However, here is the short howto! + * Torque.properties: {{{ torque.database.default.adapter=mssql torque.dsfactory.default.factory=org.apache.torque.dsfactory.JndiDataSourceFactory torque.dsfactory.default.jndi.path=java:comp/env/jdbc/fortius }}} @@ -111,11 +112,9 @@ -- EricPugh ----- - -Question: How can I execute a stored procedure +== How can I execute a stored procedure == -Answer: You can use some of the functionality exposed by the Village library to execute and deal with the result set of your stored procedure: +'''Answer:''' You can use some of the functionality exposed by the Village library to execute and deal with the result set of your stored procedure: {{{ import com.workingdogs.village.Record; @@ -140,11 +139,9 @@ -- EricPugh ----- +== How to add !P6Spy for printing SQL == -Question: How to add !P6Spy for printing SQL - -Answer: +'''Answer:''' 1. add the p6spy.jar to your application classpath 1. copy the "spy.properties" into your classpath (e.g. same location as log4j.properties) @@ -155,21 +152,15 @@ -- Siegfried Goeschl ----- - -Question: doDelete() is throwing a !TorqueException. What's up? +== doDelete() is throwing a !TorqueException. What's up? == -Answer: doDelete() throws a !TorqueException with message "You must specify Key''''''Def attributes for this Table''''''Data''''''Set in order to delete a Record" when the schema for the table does not contain a primary key. If the table has no primary key, doDelete() may not be used to delete from it. +'''Answer:''' doDelete() throws a !TorqueException with message "You must specify Key''''''Def attributes for this Table''''''Data''''''Set in order to delete a Record" when the schema for the table does not contain a primary key. If the table has no primary key, doDelete() may not be used to delete from it. -- Gary Shea ----- +== Is there a way to use one installation of torque for different projects without having a copy of torque-gen for each project (e.g. copy the build-torque.xml and build.properties and set a parameter in build.properties to the torque basedir)? == -Question: Is there a way to use one installation of torque for different projects without having a copy of torque-gen for each project (e.g. copy the build-torque.xml and build.properties and set a parameter in build.properties to the torque basedir) - --- Michael Wyraz - -Answer: Yes. Torque is mavenized, so you can install and use torque as a plugin for Maven. +'''Answer:''' Yes. Torque is mavenized, so you can install and use torque as a plugin for Maven. http://db.apache.org/torque/maven-plugin/ http://db.apache.org/torque/maven-howto.html @@ -180,31 +171,21 @@ -- bogdan ----- - -Question: Can I use my own ID-Generator with torque? How? +== Can I use my own ID-Generator with torque? How? == -Answer: ???? +'''Answer:''' ???? -- Michael Wyraz ----- +== We have an existing database where some of the table names have spaces as part of the name. Is there a way in which Torque could replace spaces by, say, underscores? What about table columns with spaces in the names? == -Question: We have an existing database where some of the table names have spaces as part of the name. Is there a way in which Torque could -replace spaces by, say, underscores? What about table columns with spaces in the names? --- Daniel Canas - -Answer: ???? - - ----- +'''Answer:''' ???? -Question: The save methods internally use Transaction.start() +-- Daniel Canas -What if I want save of multiple entities to be wrapped in single transaction --- Kalpesh Soni [EMAIL PROTECTED] +== The save methods internally use Transaction.start(), what if I want save of multiple entities to be wrapped in single transaction? == -Answer: Use Transaction yourself: +'''Answer:''' Use Transaction yourself: {{{ { java.sql.Connection connection = null; @@ -231,5 +212,3 @@ While coding your own transactions, make sure that the Database connection is released at the end. This is ensured in the above code because either Transaction.commit() or Transaction.rollback() are called, both of which release the database connection. Note that Transaction.safeRollback() does not release the database connection, so replacing Transaction.rollback() by transaction.safeRollback() in the above code would lead to the leakage of database connections if the transaction fails. -- Thomas Fischer - - --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
