繁体   English   中英

在hibernate工具hbm2ddl中支持@ElementCollection

[英]Support for @ElementCollection in hibernate tools hbm2ddl

我试图在我的实体中使用jpa2特性@ElementCollection作为字符串列表。 我正在使用hibernate3-maven-plugin来执行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,对于列:[org.hibernate.mapping.Column(stuffs)]

谢谢

我认为你的插件版本不匹配。 hibernate3-maven-plugin依赖于Hibernate 3.3.1.GA.

您可以尝试在hibernate3-maven-plugin上忽略它,并手动获取正确的版本(3.5.3 Final可能有效)。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM