当映射到的对象有复合键时,是否可以使用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