Build-time Properties

These properties are set in the build.properties file or the file of your chosing, specificed by the torque.contextProperties property. They affect how Torque generates Java and SQL code for your project.

Property Default Description
Basic Properties
torque.project N/A The name of the project Torque will generate code for. After choosing the project name, your XML schema file (originally project-schema.xml ), that Torque will read should be renamed to ${torque.project}-schema.xml .
torque.database N/A Torque must know the target database platform in order to generate the appropriate Java and SQL code. Currently supported values are: axion, cloudscape, db2, db2400, hypersonic, interbase, mssql, mysql, oracle, postgresql, sapdb, and sybase.
torque.targetPackage N/A The Java package that Torque will put the generated classes in. Generally something like com.company.project.om .
Directories and Paths
torque.home . The base directory for the input and output of files.
torque.templatePath templates The path relative to where Torque is being executed to load the Velocity templates from.
torque.output.dir ${torque.home}/src The base directory for the output of SQL and Java files.
torque.schema.dir ${torque.home}/schema The base directory to reading *-schema.xml files from.
torque.doc.dir ${torque.output.dir}/doc The directory to place HTML documentation generated from the XML schema.
torque.java.dir ${torque.output.dir}/java The directory to place all of the generated Java code in.
torque.javadoc.dir ${torque.output.dir}/javadoc The directory to javadocs generated from the Java om files.
torque.ojb.dir ${torque.output.dir}/ojb The directory to place all of the generated OJB code in.
Database Settings
torque.database.createUrl N/A The JDBC URL that Torque can use to create and drop databases if instructed to do so. This is typically an administrative URL.
torque.database.buildUrl N/A The JDBC URL that will be used to access your database. Torque can use this to create your tables if instructed to do so. This value should reflect the database name specified in the database schema file (described in the next section).
torque.database.url N/A This should contain the same value as buildDatabaseURL . [not quite sure why both of these properties exist]
torque.database.driver N/A The JDBC database driver to use when connecting to your database.
torque.database.user N/A The administrative username that has sufficient privileges to create and drop databases and tables that Torque executes at build time.
torque.database.password N/A The administrative password for the supplied username.
torque.database.host N/A The hostname or IP address of your database server.
torque.database.schema N/A Used by the JDBC -> XML process, and by the SQL Ant Task that will initialize your target database with the generated SQL. This is only used by Oracle at this time. This must be UPPERCASE!
torque.database.name N/A The database name to use in the datadump target.
torque.database.manualCreation false When false , Torque can automatically execute the SQL to create your database tables via the create-db target. This will destroy old data, so manual creation is safer in non-dev environments.
torque.sameJavaName false
Template Variables
torque.addGetByNameMethod true If true, Torque adds methods to get database fields by name/position.
torque.addIntakeRetrievable false If true, the data objects will implement Intake's Retrievable interface
torque.retrievableInterface org.apache.turbine.om.Retrievable (for Turbine 2.2) Defines the Retrievable interface. (set to org.apache.fulcrum.intake.Retrievable if you are using Fulcrum)
torque.addSaveMethod true If true, Torque adds tracking code to determine how to save objects.
torque.saveException Exception Defines which Exception should be thrown by the Object.save() method.
torque.addTimeStamp true If true, Torque puts time stamps in generated om files.
torque.basePrefix Base A string to pre-pend to the file names of base data and peer objects.
torque.complexObjectModel true If true, Torque generates data objects with collection support and methods to easily retrieve foreign key relationships.
torque.useClasspath false If true, Torque will not look in the templatePath directory, for templates, but instead load them from the classpath, allowing you to use Torque without extracting it from the jar.
torque.useManagers false If true, Torque will generate Manager classes that use JCS for caching. Still considered experimental.
Misc. Settings
torque.idTableXMLFile N/A
torque.doc.format html Possible values are html and anakia.
torque.doc.html.normalFont font-family: Verdana; font-size: 10pt; The value for the CSS class normalFont that is used to format the text of the HTML output.
torque.doc.html.fkColor afe295 The color that the names of foreign key columns are highlighted with in the HTML output.
torque.initialID 101 Controls the starting id of table entries when creating SQL for the id-table. If you have two projects that use the same id-table in the same database with different tables, make sure that they have different initialID settings and the ranges (initialID is incremented for every new table) don't overlap.
torque.initialIDValue 1000 The start value of the ID broker for supplying IDs to Torque. This value is incremented every time Torque requests ID keys from the broker. If you pre-load your table straight from SQL, make sure that you don't accidentially overlap with this setting, because Torque doesn't keep record of what IDs are already taken in the database. If you overlap, inserting new objects will fail because the ID assigned by Torque is already taken.
torque.initialIDStep 10 For performance reasons, the ID Broker does not request a single ID at a time but fetches a whole range and increments the current next ID Value in the ID Table by this step. If you have to do lots of inserts straight in a row, increment this value to get slightly better performance.
Compile Settings
torque.compile.src.dir ${torque.java.dir} Where to read the Java om source files.
torque.compile.build.dir bin/classes Where to put the compiled byte code for om classes.
torque.compile.debug on Whether the om classes are compiled with debug code.
torque.compile.deprecation off Whether the om classes are compiled with deprecation allowed.
torque.compile.optimize off Whether the om classes are optimized during compilation.