Maven + Hibernate注释模式生成

Flo*_*rin 6 maven-2 annotations hibernate hibernate-mapping hibernate-annotations

我有一堆用hibernate注释注释的类.我正在使用Maven,Hibernate和Spring.如何使用hibernate3-maven-plugin的hbm2ddl生成数据库模式?

khm*_*ise 4

像这样的简短示例:

<build>
<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>hibernate3-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
      <components>
        <component>
          <name>hbm2ddl</name>
          <implementation>jdbcconfiguration</implementation>
        </component>
      </components>
      <componentProperties>
        <drop>true</drop>
        <configurationfile>/src/main/resources/hibernate.cfg.xml</configurationfile>
      </componentProperties>
    </configuration>
    <dependencies>
      <dependency>
        <groupId>jdbc.artifact.groupid</groupId>
        <artifactId>jdbc-driver</artifactId>
        <version>1.0</version>
      </dependency>
    </dependencies>
  </plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)

当然,阅读文档会有帮助。

  • 当然不是。抱歉...只需将其替换为:annotationconfiguration (2认同)