Hibernate 什么';这是在hbm2java生成过程中修改POJO文件名的最简单方法
我通过maven使用hbm2java生成POJO,它将生成Table.java之类的文件,但我想要的是AbstractTable.java 有没有一个简单的方法可以做到这一点 从my pom.xml:Hibernate 什么';这是在hbm2java生成过程中修改POJO文件名的最简单方法,hibernate,maven-2,reverse-engineering,hbm2java,Hibernate,Maven 2,Reverse Engineering,Hbm2java,我通过maven使用hbm2java生成POJO,它将生成Table.java之类的文件,但我想要的是AbstractTable.java 有没有一个简单的方法可以做到这一点 从my pom.xml: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.2&
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>hbm2hbmxml</id>
<phase>generate-sources</phase>
<goals>
<goal>hbm2hbmxml</goal>
</goals>
<configuration>
<components>
<component>
<name>hbm2hbmxml</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
</componentProperties>
</configuration>
</execution>
<execution>
<id>hbm2cfgxml</id>
<phase>generate-sources</phase>
<goals>
<goal>hbm2cfgxml</goal>
</goals>
<configuration>
<components>
<component>
<name>hbm2cfgxml</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
</componentProperties>
</configuration>
</execution>
<execution>
<id>hbm2java</id>
<phase>generate-sources</phase>
<goals>
<goal>hbm2java</goal>
</goals>
<configuration>
<components>
<component>
<name>hbm2java</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
<namingstrategy>uk.co.company.product.hibernate.CustomNamingStrategy</namingstrategy>
</componentProperties>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>3.2.3.GA</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.8</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency>
</dependencies>
</plugin>
org.codehaus.mojo
hibernate3 maven插件
2.2
hbm2hbmxml
生成源
hbm2hbmxml
hbm2hbmxml
总工程师/总工程师
src/conf/reveng.xml
src/conf/hibernate.properties
src/conf/hibernate模板
真的
hbm2cfgxml
生成源
hbm2cfgxml
hbm2cfgxml
总工程师/总工程师
src/conf/reveng.xml
src/conf/hibernate.properties
src/conf/hibernate模板
真的
hbm2java
生成源
hbm2java
hbm2java
总工程师/总工程师
src/conf/reveng.xml
src/conf/hibernate.properties
src/conf/hibernate模板
真的
uk.co.company.product.hibernate.CustomNamingStrategy
org.hibernate
休眠工具
3.2.3.GA
org.codehaus.mojo
hibernate3 maven插件
2.2
mysql
mysql连接器java
5.0.8
cglib
cglibnodep
2.1_3
定制模板似乎是实现这一目标的方法。
最后,我从jar中提取了pojo模板文件,以便修改它们,然后在pojo模板和filepattern上使用hbmtemplate来完成这项工作。有点恼人的是,不能将文件模式与hbm2pojo一起使用
如果有人感兴趣,这是我的pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>hbm2hbmxml</id>
<phase>generate-sources</phase>
<goals>
<goal>hbm2hbmxml</goal>
</goals>
<configuration>
<components>
<component>
<name>hbm2hbmxml</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
</componentProperties>
</configuration>
</execution>
<execution>
<id>hbm2cfgxml</id>
<phase>generate-sources</phase>
<goals>
<goal>hbm2cfgxml</goal>
</goals>
<configuration>
<components>
<component>
<name>hbm2cfgxml</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
</componentProperties>
</configuration>
</execution>
<execution>
<id>hbmtemplate0</id>
<phase>generate-sources</phase>
<goals>
<goal>hbmtemplate</goal>
</goals>
<configuration>
<components>
<component>
<name>hbmtemplate</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
<ejb3>false</ejb3>
<filepattern>{package-name}/Abstract{class-name}.java</filepattern>
<templateprefix>pojo/</templateprefix>
<destdir>src/main</destdir>
<template>pojo/Pojo.ftl</template>
</componentProperties>
</configuration>
</execution>
<execution>
<id>hbmtemplate1</id>
<phase>generate-sources</phase>
<goals>
<goal>hbmtemplate</goal>
</goals>
<configuration>
<components>
<component>
<name>hbmtemplate</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
<ejb3>false</ejb3>
<filepattern>{package-name}/{class-name}.java</filepattern>
<templateprefix>pojoImpl/</templateprefix>
<destdir>src/main</destdir>
<template>pojoImpl/PojoImpl.ftl</template>
</componentProperties>
</configuration>
</execution>
<execution>
<id>hbmtemplate2</id>
<phase>generate-sources</phase>
<goals>
<goal>hbmtemplate</goal>
</goals>
<configuration>
<components>
<component>
<name>hbmtemplate</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
<ejb3>false</ejb3>
<filepattern>{package-name}/Abstract{class-name}DAO.java</filepattern>
<templateprefix>dao/</templateprefix>
<destdir>src/main</destdir>
<template>dao/daohome.ftl</template>
<sessionFactoryName>sessionFactoryName.goes.here</sessionFactoryName>
</componentProperties>
</configuration>
</execution>
<execution>
<id>hbmtemplate3</id>
<phase>generate-sources</phase>
<goals>
<goal>hbmtemplate</goal>
</goals>
<configuration>
<components>
<component>
<name>hbmtemplate</name>
<outputDirectory>src/main</outputDirectory>
</component>
</components>
<componentProperties>
<revengfile>src/conf/reveng.xml</revengfile>
<propertyfile>src/conf/hibernate.properties</propertyfile>
<templatepath>src/conf/hibernate-templates</templatepath>
<jdk5>true</jdk5>
<ejb3>false</ejb3>
<filepattern>{package-name}/{class-name}DAO.java</filepattern>
<templateprefix>daoImpl/</templateprefix>
<destdir>src/main</destdir>
<template>daoImpl/daoImpl.ftl</template>
<sessionFactoryName>sessionFactoryName.goes.here</sessionFactoryName>
</componentProperties>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>3.2.3.GA</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.8</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency>
</dependencies>
</plugin>
org.codehaus.mojo
hibernate3 maven插件
2.2
hbm2hbmxml
生成源
hbm2hbmxml
hbm2hbmxml
总工程师/总工程师
src/conf/reveng.xml
src/conf/hibernate.properties
src/conf/hibernate模板
真的
hbm2cfgxml
生成源
hbm2cfgxml
hbm2cfgxml
总工程师/总工程师
src/conf/reveng.xml
src/conf/hibernate.properties
src/conf/hibernate模板
真的
hbmtemplate0
生成源
hbmtemplate
hbmtemplate
总工程师/总工程师
src/conf/reveng.xml
src/conf/hibernate.properties
src/conf/hibernate模板
真的
假的
{package name}/Abstract{class name}.java
波乔/
总工程师/总工程师
pojo/pojo.ftl
hbmtemplate1
生成源
hbmtemplate
hbmtemplate
总工程师/总工程师
src/conf/reveng.xml
src/conf/hibernate.properties
src/conf/hibernate模板
真的
假的
{package name}/{class name}.java
波乔林/
总工程师/总工程师
pojoImpl/pojoImpl.ftl
hbmtemplate2
生成源
hbmtemplate
hbmtemplate
总工程师/总工程师
src/conf/reveng.xml
src/conf/hibernate.properties
src/conf/hibernate模板
真的
假的
{包名}/抽象{类名