`

hibernate3-maven-plugin 配置

    博客分类:
  • jpa
阅读更多

使用hibernate3-maven-plugin 可根据hibernate 或JPA的配置导出建表脚本,根据表结构导出java类,如下是根据JPA的配置信息导出建表脚本的例子:

 

 

<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>hibernate3-maven-plugin</artifactId>
				<version>2.2</version>
				<executions>
					<execution>
						<goals>
							<goal>hbm2ddl</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<components>
						<component>
							<name>hbm2ddl</name>
							<implementation>jpaconfiguration</implementation>
							<outputDirectory>src/main/db</outputDirectory>
						</component>
					</components>
					<componentProperties>
						<persistenceunit>PersistenceUnit</persistenceunit>
						<outputfilename>schema.ddl</outputfilename>
						<drop>false</drop>
						<create>true</create>
						<export>false</export>
						<format>true</format>
					</componentProperties>
				</configuration>
			</plugin>
 

其中persistenceunit 与persistence.xml文件的持久单元名称保持一致。

 

运行时使用 mvn:hibernate3:hbm2ddl

 

分享到:
评论
1 楼 carlos 2012-12-13  












        

相关推荐

Global site tag (gtag.js) - Google Analytics