在hibernate4中,注释@MapKey';的targetElement属性被什么替换?

在hibernate4中,注释@MapKey';的targetElement属性被什么替换?,hibernate,Hibernate,在hibernate4中,注释@MapKey的targetElement属性被什么替换 @ElementCollection @MapKey(targetElement = ProductAttribute.class) @LazyCollection(LazyCollectionOption.TRUE) @Cascade(value = { CascadeType.DELETE }) public Map<ProductAttribute, String> getProductAt

在hibernate4中,注释@MapKey的targetElement属性被什么替换

@ElementCollection
@MapKey(targetElement = ProductAttribute.class)
@LazyCollection(LazyCollectionOption.TRUE)
@Cascade(value = { CascadeType.DELETE })
public Map<ProductAttribute, String> getProductAttributeMapStore() {
    return productAttributeMapStore;
}
@ElementCollection
@MapKey(targetElement=ProductAttribute.class)
@LazyCollection(LazyCollectionOption.TRUE)
@级联(值={CascadeType.DELETE})
公共地图getProductAttributeMapStore(){
返回productAttributeMapStore;
}
现在,我将项目的hibernate.jar从hibernate3升级到hibernate4.1,可以找到intellJ alert targetElement。

As,
org.hibernate.annotations.Mapkey
注释已被弃用,取而代之的是

根据API文档,不推荐使用该属性,因为:

仅当集合不使用泛型时才有用

在这种特定情况下,使用targetElement是重复的,因为映射键的类型已经通过使用泛型给出:

Map<ProductAttribute, String>
Map

javax.persistence.MapKeyColumn
替换legancy
MapKey
是否正确以使代码正确编译?另一个问题:在hibernate4中,注释@MapKey被什么替换了?请看我非常类似的问题: