2012-05-16 3 views
0

내 SQL 데이터베이스는 "Item"테이블을 가지고있다. 각 "항목"에는 여러 가지 대체 레이블이있을 수 있습니다. 이들은 "ItemAltLabel"이라는 다른 테이블에 저장됩니다. 외래 키는 "ItemID"입니다.Hibernate, (netbeans 7.1.2, maven) ElementCollection 속성을 사용할 수 없다.

자바에서 문자열 대체 레이블 세트가있는 엔티티로 표현하려고합니다.

@ElementCollection 
@CollectionTable(name="ItemAltLabel", [email protected](name="ItemID")) 
@Column(name="Label") 
private Set<String> alternateLabels; 

이 정확해야 :

내 재산은 다음과 같습니다?

내가 오류는 다음과 같습니다 당신이 경우

http://blog.m1key.me/2010/06/orghibernatemappingexception-could-not.html

"나는이 게시물에, 그것은 내가 사용하고 최대 절전 모드의 버전에서 버그가 제안 발견

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityBroker': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.hibernate.SessionFactory com.porism.dao.BaseBroker.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: java.util.Set, for columns: [org.hibernate.mapping.Column(Label)]

이와 비슷한 상황에서이 오류가 발생하는 이유는 Hibernate 구현의 버그이며 더 새로운 것 (3.5.3-Final 또는 그 이후가 좋습니다)을 얻어야합니다. "

내 치어 파일은 3 절전 종속성을 의미한다 :

<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate</artifactId> 
    <version>3.2.5.ga</version> 
</dependency> 
<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-entitymanager</artifactId> 
    <version>3.3.2.GA</version> 
</dependency> 
<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-core</artifactId> 
    <version>3.3.2.GA</version> 
</dependency> 

내가 3.5.3 - 마지막으로 이러한 업데이트 시도 (포스트에서 알 수 있듯이).

내 저장소는 다음과 같다 :

http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo 도서관 도서관 정보 [EclipseLink가 기본 저장소는 EclipseLink ] http://download.java.net/maven/2/ 최대 절전 모드 지원을 기본 저장소 라이브러리에 대한 라이브러리 [최대 절전 모드 지원]

프로젝트를 빌드 할 때 내가 오류입니다 : 내가 최대 절전 모드 3.5.3-최종에 대한 종속성을 제거하면

Failed to execute goal on project InformWebServices: Could not resolve dependencies for project porism:InformWebServices:war:1.0: Could not transfer artifact org.hibernate:hibernate:jar:3.5.3-Final from/to eclipselink (http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo): Connection to http://ftp.ing.umu.se refused: Connection timed out: connect -> [Help 1]

는 다른 두 의존성이 성공적으로 다운로드됩니다. 프로젝트가 구축됩니다. 새로운 오류가 나타납니다.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityBroker': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.hibernate.SessionFactory com.porism.dao.BaseBroker.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.cfg.AnnotationConfiguration

NetBeans 7.1.2 및 maven을 사용하고 있습니다.

아마도 내가 말할 수 있듯이, 나는 프로젝트를 건네줬고, 내가하는 일에 대한 단서가 없다. 어떤 도움이라도 대단히 감사하겠습니다.

최대 절전 모드 4로 업그레이드를 시도했지만 이로 인해 많은 문제가 발생했으며 가능한 한 사용했던 버전에 가까운 상태로 유지하는 것이 좋습니다.

답변

1

org.hibernate : hibernate 의존성이 무엇을 참조해야하는지 확실하지 않습니다. 하지만 그것은 분명히 우리 (최대 절전 모드 팀)가 생산하는 항아리가 아닙니다.

org.hibernate : hibernate-entitymanager 종속성 만 지정하면됩니다. 그것은 실제로 org.hibernate : hibernate-core를 일시적으로 끌어 들일 것이다. 그리고 이것들은 3.5+로 업그레이드되어야합니다.

+0

당신의 도움에 감사드립니다. 나는 org.hibernate : hibernate가 pom 파일이고, pom이 필요하다는 것을 알았다. 또한 org.slf4j에 종속성을 추가해야했습니다. slf4j-log4j12 (1.5.0) – zod