2010-11-15 54 views
1

我想在我的实体中使用jpa2特性@ElementCollection作为字符串列表。我正在使用hibernate3-maven-plugin来执行hbm2ddl任务。在hibernate工具中支持@ElementCollection hbm2ddl

但是看起来插件使用的hibernate工具版本并不知道如何处理@ElementCollection注解,任何人都可以给我一些关于我需要使用哪些版本的hibernate工具的指针,这样做并非如此。它应该只是一个指定正确版本的hibernate工具的例子吗?

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>hibernate3-maven-plugin</artifactId> 
    <version>2.2</version> 
    <dependencies> 
<dependency> 
    <groupId>postgresql</groupId> 
    <artifactId>postgresql</artifactId> 
    <version>8.3-603.jdbc4</version> 
    </dependency> 
    <dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-tools</artifactId> 
    <version>3.2.4.GA</version> 
    <type>jar</type> 
    <scope>runtime</scope> 
</dependency> 

[INFO]跟踪 org.hibernate.MappingException:可能 无法确定类型: java.util.List的,在表中:的MyStuff,用于 列: [有机.hibernate.mapping.Column(东西)]

由于

回答

4

我认为你只是有一个版本与插件不匹配。 hibernate3-maven-plugin对Hibernate 3.3.1.GA有依赖性。

您可以尝试忽略hibernate3-maven插件上的内容,并手动获取正确的版本(3.5.3 Final可能工作)。

也许在字段而不是setter上设置注释也可能有帮助。

+0

其中哪些解决了您的问题? – Eddie 2011-07-20 17:53:46

+0

很想看看如何解决这个问题! – 2011-11-19 18:58:34

+0

以下[链接](http://blog.flurdy.com/2010/07/orghibernatemappingexception-could-not.html)提供了让插件按需要工作所需的步骤。 当我更新到最新版本的org.hibernate:hibernate-entitymanager到它工作的插件时,我正试图改变插件中的hibernate工具版本。 – 2013-01-10 11:56:52