首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基于定制ReverseEgineeringStrategy的逆向工程

基于定制ReverseEgineeringStrategy的逆向工程
EN

Stack Overflow用户
提问于 2014-05-13 15:27:42
回答 1查看 980关注 0票数 2

我想使用自定义ReverseEgineeringStrategy进行反向工程(从我的数据库生成java类)。我成功地使用了hibernate-tools插件来实现eclipse。但是我想用hibernate3-maven-plugin来做这件事。我找了很多例子,但我发现的例子对我都没有用。

如果有人知道我们怎么做的话,我很感激他的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-14 12:25:08

我试过hibernate3-maven-plugin版本3.0

代码语言:javascript
复制
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>3.0</version>

不幸的是,我有错误,我没有成功地使它发挥作用(异常消息对我也没有太大帮助)。

所以我尝试了2.2版本,它运行得很好,这里是我的pom.xml

代码语言:javascript
复制
<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>hibernate3-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <id>hbm2java</id>
                    <phase>install</phase>
                    <goals>
                        <goal>hbm2java</goal>
                    </goals>
                    <inherited>false</inherited>
                    <configuration>
                        <components>
                            <component>
                                <name>hbm2java</name>
                                <implementation>jdbcconfiguration</implementation>
                                <outputDirectory>target/generatedClasses</outputDirectory>
                            </component>
                        </components>
                        <componentProperties>
                            <jdk5>true</jdk5>
                            <ejb3>false</ejb3>
                            <revengfile>${basedir}\hibernate.reveng.xml</revengfile>
                            <reversestrategy>com.it.mybatis.MyReverseEngineeringStrategy</reversestrategy>
                            <propertyfile>${basedir}\database.properties</propertyfile>
                        </componentProperties>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc14</artifactId>
                    <version>10.2.0.2.0</version>
                </dependency>
                <dependency>
                    <groupId>cglib</groupId>
                    <artifactId>cglib-nodep</artifactId>
                    <version>2.1_3</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>


<dependencies>
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis</artifactId>
        <version>3.2.5</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-tools</artifactId>
        <version>4.0.0-CR1</version>
    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.2.0</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.4</version>
    </dependency>
</dependencies>

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23635459

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档