首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

hibernate3-maven-plugin 配备

2012-09-08 
hibernate3-maven-plugin 配置使用hibernate3-maven-plugin 可根据hibernate 或JPA的配置导出建表脚本,根

hibernate3-maven-plugin 配置

使用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

?

热点排行