无法生成POJO“Hibernate工具使用Maven进行逆向工程”

时间:2017-04-11 11:25:32

标签: hibernate maven maven-plugin hibernate3-maven-plugin

我正在获得构建成功但仍然是java文件而不是生成。我正在使用hibernate3-maven-plugin 2.2来生成bean。

数据库:Postgres 9.6

我的pom.xml

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>hibernate3-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <components>
                        <component>
                            <name>hbm2hbmxml</name>
                            <implementation>jdbcconfiguration</implementation>
                            <outputDirectory>target/generated-resources/hibernate3</outputDirectory>
                        </component>
                        <component>
                            <name>hbm2java</name>
                            <implementation>jdbcconfiguration</implementation>
                            <outputDirectory>target/generated-sources/hibernate3</outputDirectory>
                        </component>
                    </components>
                    <componentProperties>
                        <revengfile>src/main/resources/hibernate.reveng.xml</revengfile>
                        <propertyfile>src/main/resources/hibernate.properties</propertyfile>
                        <packagename>com.whatever.domain</packagename>
                        <jdk5>true</jdk5>
                        <ejb3>true</ejb3>
                    </componentProperties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>cglib</groupId>
                        <artifactId>cglib-nodep</artifactId>
                        <version>2.2.2</version>
                    </dependency>
                    <dependency>
                        <groupId>org.postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                        <version>9.4.1207.jre7</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

我的hibernate.reveng.xml

<hibernate-reverse-engineering>
</hibernate-reverse-engineering>

我没有在hibernate.reveng.xml中添加任何内容。

日志:

▶ mvn hibernate3:hbm2java

[INFO] Scanning for projects... 
[INFO] 
[INFO]
------------------------------------------------------------------------ [INFO] Building demo 0.0.1-SNAPSHOT 
[INFO]
------------------------------------------------------------------------ [INFO] 
[INFO] >>> hibernate3-maven-plugin:2.2:hbm2java (default-cli) > process-resources @ demo >>> 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 3 resources 
[INFO] 
[INFO] <<< hibernate3-maven-plugin:2.2:hbm2java (default-cli) < process-resources @ demo <<< 
[INFO] 
[INFO] --- hibernate3-maven-plugin:2.2:hbm2java (default-cli) @ demo --- [INFO] using jdbcconfiguration task. 
[INFO] Hibernate 3.3.1.GA 
[INFO] loaded properties from resource hibernate.properties: {hibernate.connection.username=master, hibernate.default_schema=DBProd, hibernate.connection.password=****, hibernate.dialect=org.hibernate. dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql://192.168.99.100:5432/DBProd, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.driver_class=org.postgresql.Dri ver} 
[INFO] Bytecode provider name : javassist 
[INFO] using JDK 1.4 java.sql.Timestamp handling 
[INFO] Configuration XML file loaded: file:/Users/admin/projects/manish/exp/hbmdemo/test1/src/main/resources/hibernate.cfg.xml [INFO] configuring from url: file:/Users/admin/projects/manish/exp/hbmdemo/test1/src/main/resources/hibernate.cfg.xml 
[INFO] Configured SessionFactory: null 
[INFO] Configuration Properties file loaded: /Users/admin/projects/manish/exp/hbmdemo/test1/src/main/resources/hibernate.properties [INFO] Override file: /Users/admin/projects/manish/exp/hbmdemo/test1/src/main/resources/hibernate.reveng.xml [INFO] Using Hibernate built-in connection pool (not for production use!) [INFO] Hibernate connection pool size: 20 
[INFO] autocommit mode: false 
[INFO] using driver: org.postgresql.Driver at URL: jdbc:postgresql://192.168.99.100:5432/DBProd 
[INFO] connection properties: {user=master, password=****}
[INFO] RDBMS: PostgreSQL, version: 9.6.2 
[INFO] JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 9.4.1207.jre7 
[INFO] Using dialect: org.hibernate.dialect.PostgreSQLDialect 
[INFO] Using default transaction strategy (direct JDBC transactions) 
[INFO] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 
[INFO] Automatic flush during beforeCompletion(): disabled 
[INFO] Automatic session close at end of transaction: disabled 
[INFO] JDBC batch size: 15 
[INFO] JDBC batch updates for versioned data: disabled 
[INFO] Scrollable result sets: enabled 
[INFO] JDBC3 getGeneratedKeys(): enabled 
[INFO] Connection release mode: auto 
[INFO] Default schema: DBProd 
[INFO] Default batch fetch size: 1 
[INFO] Generate SQL with comments: disabled 
[INFO] Order SQL updates by primary key: disabled 
[INFO] Order SQL inserts for batching: disabled 
[INFO] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory [INFO] Using ASTQueryTranslatorFactory 
[INFO] Query language substitutions: {} 
[INFO] JPA-QL strict compliance: disabled 
[INFO] Second-level cache: enabled 
[INFO] Query cache: disabled 
[INFO] Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 
[INFO] Optimize cache for minimal puts: disabled
[INFO] Structured second-level cache entries: disabled 
[INFO] Statistics: disabled 
[INFO] Deleted entity synthetic identifier rollback: disabled 
[INFO] Default entity-mode: pojo 
[INFO] Named query checking : enabled 
[INFO] cleaning up connection pool: jdbc:postgresql://192.168.99.100:5432/DBProd 
[INFO] Hibernate Tools 3.2.2.GA 
[INFO]
------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO]
------------------------------------------------------------------------ [INFO] Total time: 2.121 s 
[INFO] Finished at: 2017-04-11T16:15:42+05:30 
[INFO] Final Memory: 9M/140M [INFO]
------------------------------------------------------------------------ [INFO] cleaning up connection pool: jdbc:postgresql://192.168.99.100:5432/DBProd

我在日志中找不到任何错误。不知道为什么不创建POJO?任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

尝试在 hibernate.reveng.xml

中定义架构名称
<hibernate-reverse-engineering>
   <schema-selection match-schema="GEST_CORSI"/>
</hibernate-reverse-engineering>

答案 1 :(得分:0)