Hibernate @Any Annotation和Multiple Join Columns(即:Composite Key)

时间:2015-08-07 22:09:09

标签: java hibernate groovy orm hibernate-mapping

当映射到的对象有复合键时,是否可以使用Hibernate @Any注释?我尝试了以下注释组合:

@Any(metaColumn = @Column(name = 'META_COLUMN'))
@AnyMetaDef(idType = 'string', metaType = 'string', metaValues = [
    @MetaValue(value = 'V1', targetEntity = Object1),
    @MetaValue(value = 'V2', targetEntity = Object1),
    @MetaValue(value = 'V3', targetEntity = Object2)
])
@JoinColumns([
    @JoinColumn(name = 'COLUMN1'),
    @JoinColumn(name = 'COLUMN2'),
    @JoinColumn(name = 'COLUMN3')
])

不幸的是,这导致了

org.hibernate.MappingException: property mapping has wrong number of columns: ca.package.class type: object

0 个答案:

没有答案