> is there a way to generate schema.xml from existing db schema (this woulb
> be prefered way) or from existing POJOs (entities)?
Yes.
For maven, fgenerate the schema from the database using jdbc metadata by:
<plugin>
<groupId>org.apache.torque</groupId>
<artifactId>torque-maven-plugin</artifactId>
<version>4.0</version>
<executions>
<execution>
<id>generate-schema-from-jdbc</id>
<phase>generate-resources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<packaging>classpath</packaging>
<configPackage>org.apache.torque.templates.jdbc2schema</configPackage>
<defaultOutputDir>target/generated-schema</defaultOutputDir>
<defaultOutputDirUsage>none</defaultOutputDirUsage>
<loglevel>info</loglevel>
<options>
<torque.jdbc2schema.driver>$
{driver}</torque.jdbc2schema.driver>
<torque.jdbc2schema.url>$
{database.url}</torque.jdbc2schema.url>
<torque.jdbc2schema.user>$
{database.user}</torque.jdbc2schema.user>
<torque.jdbc2schema.password>$
{database.password}</torque.jdbc2schema.password>
</options>
</configuration>
</execution>
</executions>
</plugin>
Note that the generated schema is just a starting point, there is some
information missing from jdbc metadata (e.g. foreign keys, indexes, unique
constraints...)
Hope that helps,
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]