두 답변 상자에서 나를 위해 일했다. 약간의 연구 끝에 데이터베이스에서 POJO를 생성 할 수있었습니다. 희망이 빠른 사람을 추적합니다.
Java 파일을 생성하기 만하면 매핑 파일이 생성되지 않습니다.
src/test/resources/reveng/hibernate.cfg.xml에서 데이터베이스 연결을 정의하십시오. 테스트 분기를 사용하므로이 파일은 배포 가능 이슈에 복사되지 않습니다.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="pmSessionFactory">
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<!-- Note that we are pointing directly at the catalog so we can use
unqualified table names -->
<property name="hibernate.connection.url">jdbc:oracle:thin:@server.domain.com:1521:catalog</property>
<property name="hibernate.connection.password">login</property>
<property name="hibernate.connection.username">****</property>
<property name="hibernate.default_schema">PM</property>
</session-factory>
</hibernate-configuration>
은 가져올 테이블의 목록을 작성합니다. 다시 테스트 분기 : SRC/테스트/자원/reveng/model.reveng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC
"-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<!-- This assumes your database connection is pointing to the proper catalog -->
<!-- To get all tables in the named schema, use the following
<schema-selection match-schema="PM" />
-->
<!-- to get only the named tables -->
<schema-selection match-schema="PM" match-table="PM_PROPERTY"/>
<schema-selection match-schema="PM" match-table="PM_APPLICATION"/>
<schema-selection match-schema="PM" match-table="PM_PROPERTY_TYPE"/>
</hibernate-reverse-engineering>
당신의 치어로 Hibernate3은 받는다는 플러그인을 추가
<build>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<components>
<component>
<name>hbm2java</name>
<outputDirectory>src/main/java/com/me/examples/pm/data</outputDirectory>
<implementation>jdbcconfiguration</implementation>
</component>
</components>
<componentProperties>
<!-- Storing the reveng files in the test branch means we are not
deploying connection information-->
<revengfile>src/test/resources/reveng/model.reveng.xml</revengfile>
<configurationfile>src/test/resources/reveng/hibernate.cfg.xml</configurationfile>
<jdk5>true</jdk5>
<ejb3>true</ejb3>
</componentProperties>
</configuration>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>classes12</artifactId>
<version>10.2.0.1.0</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
실행 받는다는
mvn hibernate3:hbm2java
위해 나는 "수동으로"(받는다는 통해) 원하는 위치 – Bozho