Author: tfischer
Date: Sun Jul 18 10:32:52 2010
New Revision: 965205
URL: http://svn.apache.org/viewvc?rev=965205&view=rev
Log:
added jdbc2schema documentation
Modified:
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/index.xml
Modified:
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/index.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/index.xml?rev=965205&r1=965204&r2=965205&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/index.xml
(original)
+++
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/index.xml
Sun Jul 18 10:32:52 2010
@@ -21,14 +21,14 @@
<document>
<properties>
- <title>Torque-gf templates</title>
+ <title>Torque templates</title>
</properties>
<body>
<section name="Introduction">
<p>
The torque templates are a set of templates for the torque
- generator to produce code and sql for a given data model.
+ generator to produce code and SQL for a given data model.
The data model needs to follow the torque dtd (TODO: link to dtd).<br/>
In the templates, the different generation goals (om classes, sql,
doc...)
are organized in different packages. For each generation goal,
@@ -226,6 +226,60 @@
</plugin>
]]></source>
</subsection>
+ <subsection name="Generation of XML schema from an existing database">
+ <p>
+ For extracting the structure of an existing database into
+ a schema file,
+ add the following execution to the executions list
+ of the maven Torque generator plugin:
+ </p>
+ <source><![CDATA[
+ <execution>
+ <id>generate-schema-from-jdbc</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <packaging>classpath</packaging>
+
<configPackage>org.apache.torque.templates.jdbc2schema</configPackage>
+ <newFileTargetDir>target/generated-schema</newFileTargetDir>
+ <newFileTargetDirUsage>none</newFileTargetDirUsage>
+ <options>
+
<torque.jdbc2schema.driver>${torque.driver}</torque.jdbc2schema.driver>
+
<torque.jdbc2schema.url>${torque.database.url}</torque.jdbc2schema.url>
+
<torque.jdbc2schema.user>${torque.database.user}</torque.jdbc2schema.user>
+
<torque.jdbc2schema.password>${torque.database.password}</torque.jdbc2schema.password>
+
<torque.jdbc2schema.schema>${torque.database.schema}</torque.jdbc2schema.schema>
+ </options>
+ </configuration>
+ </execution>
+ ]]></source>
+ <p>
+ Replace ${torque.driver} with the fully qualified class name of the
+ database driver. Replace ${torque.database.url}
+ with the url to connect to the database.
+ Replace ${torque.database.user} and ${torque.database.password}
+ with the database username and the corresponding password.
+ You may want to replace ${torque.database.schema} with the database
+ schema to read, if not please remove the line containing it.
+ </p>
+ <p>
+ This will generate a schema.xml from all visible tables in the
+ database in the target/generated-schema directory.
+ You may then want to add the following configuration to your pom
+ to include this directory in your site:
+ </p>
+ <source><![CDATA[
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <configuration>
+ <xdocDirectory>target/generated-xdocs</xdocDirectory>
+ </configuration>
+ </plugin>
+ ]]></source>
+ </subsection>
</section>
</body>
</document>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]