2011-09-21 3 views
2

Hibernate-Core와 EntityManager 3.6.6-FINAL, hibernate-commons-annotations-와 함께 hibernate3-maven-plugin을 성공적으로 사용했다. 최근의 3.2.0.Final, hibernate-jpa-2.0-api-1.0.1.Final 및 hibernate-validator-4.0.0.GA. 이 플러그인을 통해 DDL을 생성했습니다. 프로젝트는 영속성을 위해 JPA를 사용했습니다. 따라서 그 목표는 JPA 구성을 사용하고 잘 작동했습니다.hibernate3-maven-plugin : 갱신 된 Hibernate 버전 (3.6.6-FINAL) 의존성으로 깨기

이제 hbm2cfgxml 및 hbm2java를 동일한 버전의 최대 절전 모드 코어를 사용하여 구현할 때; hibernate annotation 3.5.6-FINAL (그것은 제외 된 의존성으로서 hibernate-core 3.5.6-FINAL을 사용한다) 그리고 최대 절전 모드 주석 3.4.0.Final; IncompatibleClassChangeError를 제공합니다. 내 플러그인 구성 :

<plugins> 
    <plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>hibernate3-maven-plugin</artifactId> 
    <version>2.2</version> 
    <executions> 
     <execution> 
     <id>hbm2cfgxml</id> 
     <phase>generate-resources</phase> 
     <goals> 
      <goal>hbm2cfgxml</goal> 
     </goals> 
     <configuration> 
      <components> 
      <component> 
       <name>hbm2cfgxml</name> 
       <implementation>jdbcconfiguration</implementation> 
      </component> 
      </components> 
      <componentProperties> 
      <ejb3>true</ejb3> 
      <packagename>foo.bar</packagename> 
      </componentProperties> 
     </configuration> 
     </execution> 
     <execution> 
     <id>hbm2java</id> 
     <phase>generate-sources</phase> 
     <goals> 
      <goal>hbm2java</goal> 
     </goals> 
     <configuration> 
      <components> 
      <component> 
       <name>hbm2java</name> 
       <implementation>annotationconfiguration</implementation> 
      </component> 
      </components> 
      <componentProperties> 
      <ejb3>true</ejb3> 
      <packagename>foo.bar</packagename> 
      <configurationfile>target/hibernate3/generated-mappings/hibernate.cfg.xml</configurationfile> 
      </componentProperties> 
     </configuration> 
     </execution> 
    </executions> 
    <dependencies> 
     <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
     <version>5.1.16</version> 
     </dependency> 
     <dependency> 
     <groupId>javax.validation</groupId> 
     <artifactId>validation-api</artifactId> 
     <version>1.0.0.GA</version> 
     </dependency> 
     <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-validator</artifactId> 
     <version>4.0.0.GA</version> 
     </dependency> 
     <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-entitymanager</artifactId> 
     <version>3.6.6.Final</version> 
     </dependency> 
     <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-core</artifactId> 
     <version>3.6.6.Final</version> 
     </dependency> 
     <dependency> 
     <groupId>org.hibernate.javax.persistence</groupId> 
     <artifactId>hibernate-jpa-2.0-api</artifactId> 
     <version>1.0.1.Final</version> 
     </dependency> 
     <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-c3p0</artifactId> 
     <version>3.6.6.Final</version> 
     <exclusions> 
      <exclusion> 
      <artifactId>slf4j-api</artifactId> 
      <groupId>org.slf4j</groupId> 
      </exclusion> 
     </exclusions> 
     </dependency> 
     <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-annotations</artifactId> 
     <version>3.5.6-Final</version> 
     <type>jar</type> 
     <scope>compile</scope> 
     <exclusions> 
      <exclusion> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      </exclusion> 
     </exclusions> 
     </dependency> 
    </dependencies> 
    </plugin> 
</plugins> 

그리고 오류 : 범인의

[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2cfgxml (hbm2cfgxml) on project dss-domain: Execution hbm2cfgxml of goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2cfgxml failed: An API incompatibility was encountered while executing org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2cfgxml: java.lang.IncompatibleClassChangeError: Found interface org.hibernate.cfg.Mappings, but class was expected

어떤 아이디어? 새 하이버 네이트 버전이나 플러그인 (매우 자주 언젠가는 2.2에있는 것처럼 업데이트가 필요할 수도 있습니다.)

답변

2

나는이 문제가 최대 절전 모드 도구라고 생각하고 있습니다. 현재의 안정 버전 (3.2.4.GA) Hibernate Core 3.3.X와 호환되며 현재 git master (https://github.com/hibernate/hibernate-tools)는 Hibernate Core 3.5.X에서 작동합니다. 이들 github Hibernate Tools 포크 중 하나를 설치하고 Hibernate3는-받는다는 - 플러그인에 의존도

https://github.com/axiomalaska/hibernate-tools/tree/3.6.X - 최대 절전 모드 3.6.x에서 (공개 : 내 포크).

https://github.com/dgeraskov/hibernate-tools/tree/hibernate4 - 최대 절전 모드 4.X