Author: tfischer
Date: Mon Jul 8 20:48:52 2013
New Revision: 1500939
URL: http://svn.apache.org/r1500939
Log:
TORQUE-294: Add an example for the generation of the Init-ID-Table-SQL to the
docs.
Modified:
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/running-the-generator.xml
Modified:
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/running-the-generator.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/running-the-generator.xml?rev=1500939&r1=1500938&r2=1500939&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/running-the-generator.xml
(original)
+++
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/running-the-generator.xml
Mon Jul 8 20:48:52 2013
@@ -169,7 +169,117 @@
documentation of available options which can be used to customize
the generated output.
</p>
- </subsection>
+ </subsection>
+ <subsection name="Generation of IDBroker SQL">
+ <p>
+ For generating the SQL to fill the IDBroker tables,
+ add the following execution to the executions list
+ of the Torque Maven plugin:
+ </p>
+ <source><![CDATA[
+ <execution>
+ <id>generate-idtable-sql</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <packaging>classpath</packaging>
+
<configPackage>org.apache.torque.templates.idtable</configPackage>
+ <sourceDir>${torque.schema.source.dir}</sourceDir>
+ <defaultOutputDir>target/generated-sql</defaultOutputDir>
+ <defaultOutputDirUsage>none</defaultOutputDirUsage>
+ <options>
+ <torque.database>${torque.target.database}</torque.database>
+ </options>
+ </configuration>
+ </execution>
+ ]]></source>
+ <p>
+ Replace ${torque.target.database} with the target database type
+ (e.g. mysql, oracle). Replace ${torque.schema.source.dir}
+ with the directory where you put your database schemata
+ (e.g. /src/main/schema).
+ </p>
+ <p>
+ This will generate the sql code for all source files in the schema
+ directory ending on -schema.xml; the output goes to the directory
+ target/generated-sql.
+ </p>
+ <p>
+ See the <a href="customizing-generation.html">Customizing</a> page for
a
+ documentation of available options which can be used to customize
+ the generated output.
+ </p>
+ <p>
+ Note that for generating the ddl for the id tables,
+ you need to generate the ddl sql for the following schema file:
+ </p>
+ <source><![CDATA[
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<database name="${database.name}"
+ xmlns="http://db.apache.org/torque/4.0/templates/database"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database
+ http://db.apache.org/torque/4.0/templates/database-strict.xsd">
+
+ <table name="ID_TABLE" idMethod="idbroker">
+ <column name="ID_TABLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
+ <column name="TABLE_NAME" required="true" size="250" type="VARCHAR"/>
+ <column name="NEXT_ID" type="INTEGER"/>
+ <column name="QUANTITY" type="INTEGER"/>
+
+ <unique>
+ <unique-column name="TABLE_NAME"/>
+ </unique>
+
+ </table>
+</database>
+ ]]></source>
+ <p>
+ where ${database.name} should be replaced by the symbolic name of the
+ database for which you want to use the idbroker.
+ The generation of om classes is not required for the idbroker table.
+ </p>
+ </subsection>
+ <subsection name="Generation of database create scripts">
+ <p>
+ For generating the SQL scripts for creating a database
+ (which does not make sense for every database vendor),
+ add the following execution to the executions list
+ of the Torque Maven plugin:
+ </p>
+ <source><![CDATA[
+ <execution>
+ <id>generate-createdb-sql</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <packaging>classpath</packaging>
+
<configPackage>org.apache.torque.templates.sql.createdb</configPackage>
+ <sourceDir>${torque.schema.source.dir}</sourceDir>
+
<defaultOutputDir>target/generated-createdb-sql</defaultOutputDir>
+ <defaultOutputDirUsage>none</defaultOutputDirUsage>
+ <options>
+ <torque.database>${torque.target.database}</torque.database>
+ </options>
+ </configuration>
+ </execution>
+ ]]></source>
+ <p>
+ Replace ${torque.target.database} with the target database type
+ (e.g. mysql, oracle). Replace ${torque.schema.source.dir}
+ with the directory where you put your database schemata
+ (e.g. /src/main/schema).
+ </p>
+ <p>
+ This will generate the createdb sql code for all source files
+ in the schema directory ending on -schema.xml;
+ the output goes to the directory target/generated-createdb-sql.
+ </p>
+ </subsection>
<subsection name="Generation of html documentation">
<p>
For generating html documentation for the tables,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]