You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dan Tran <da...@gmail.com> on 2007/07/20 23:17:05 UTC

Generate DB Schema using annotated JPA classes ??

Do we have an example howto configure hibernate2-maven-plugin to generate DB
schema using
the annotated JPA classes?

Any suggestion is greatly appreciated.

Thanks

-Dan

Re: Generate DB Schema using annotated JPA classes ??

Posted by Dan Tran <da...@gmail.com>.
Jim,

you are my hero,

Here is my working config, just incase it may benefit other.


<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>hibernate3-maven-plugin</artifactId>

<version>2.0-alpha-1</version>

<configuration>

<componentProperties>

<implementation>jpaconfiguration</implementation>

<outputfilename>iplocks-schema-hsqldb.sql</outputfilename>

<persistenceunit>iplocks</persistenceunit>

<export>false</export>

</componentProperties>

<components>

<component>

<name>hbm2ddl</name>

</component>

</components>

</configuration>

<executions>

<execution>

<phase>process-classes</phase>

<goals>

<goal>hbm2ddl</goal>

</goals>

</execution>

</executions>

</plugin>

thanks

-D






On 7/20/07, Jim Crossley <ji...@crossleys.org> wrote:
>
> Hi Dan...
>
> "Dan Tran" <da...@gmail.com> writes:
>
> > Do we have an example howto configure hibernate2-maven-plugin to
> > generate DB schema using the annotated JPA classes?
>
> I set up a profile in my pom to build pretty pictures of our schema
> using the 'hbm2doc' component of the hibernate3-maven-plugin.  I think
> generating the schema instead amounts to choosing another component,
> but I'm not sure off the top of my head what that is.  Either the docs
> for the plugin or google will tell you.  If you can't find it, ping
> me, and I'll snarf it out for you.  Here's my profile:
>
> <profile>
>    <id>db.doc</id>
>    <dependencies>
>      <dependency>
>        <groupId>hsqldb</groupId>
>        <artifactId>hsqldb</artifactId>
>        <version>1.8.0.7</version>
>      </dependency>
>    </dependencies>
>    <build>
>      <plugins>
>        <plugin>
>          <groupId>org.codehaus.mojo</groupId>
>          <artifactId>hibernate3-maven-plugin</artifactId>
>          <configuration>
>            <dotExecutable>/usr/bin/dot</dotExecutable>
>            <components>
>              <component>
>                <name>hbm2doc</name>
>                <implementation>jpaconfiguration</implementation>
>              </component>
>            </components>
>            <componentProperties>
>              <persistenceunit>hibernate-hsqldb</persistenceunit>
>            </componentProperties>
>          </configuration>
>        </plugin>
>      </plugins>
>    </build>
> </profile>
>
> Jim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Generate DB Schema using annotated JPA classes ??

Posted by Jim Crossley <ji...@crossleys.org>.
Hi Dan...

"Dan Tran" <da...@gmail.com> writes:

> Do we have an example howto configure hibernate2-maven-plugin to
> generate DB schema using the annotated JPA classes?

I set up a profile in my pom to build pretty pictures of our schema
using the 'hbm2doc' component of the hibernate3-maven-plugin.  I think
generating the schema instead amounts to choosing another component,
but I'm not sure off the top of my head what that is.  Either the docs
for the plugin or google will tell you.  If you can't find it, ping
me, and I'll snarf it out for you.  Here's my profile:

  <profile>
    <id>db.doc</id>
    <dependencies>
      <dependency>
        <groupId>hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>1.8.0.7</version>
      </dependency>
    </dependencies>
    <build>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>hibernate3-maven-plugin</artifactId>
          <configuration>
            <dotExecutable>/usr/bin/dot</dotExecutable>
            <components>
              <component>
                <name>hbm2doc</name>
                <implementation>jpaconfiguration</implementation>
              </component>
            </components>
            <componentProperties>
              <persistenceunit>hibernate-hsqldb</persistenceunit>
            </componentProperties>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>

Jim


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org