今天,我们发布了 Hibernate ORM 6.1 的新维护版本:6.1.2.Final。
新增功能
本版本引入了一些小的改进和错误修复。
@Any 映射和 HQL 函数 type(…)
现在可以使用 HQL 函数 type(…)
访问多态关联的类型。
例如:
@Entity
public class PropertyHolder {
@Any
@AnyDiscriminator(DiscriminatorType.STRING)
@AnyDiscriminatorValue(discriminator = "S", entity = StringProperty.class)
@AnyDiscriminatorValue(discriminator = "I", entity = IntegerProperty.class)
@AnyKeyJavaClass(Integer.class)
@Column(name = "property_type")
@JoinColumn(name = "property_id")
private Property property;
...
}
public interface Property {
...
}
@Entity
public class IntegerProperty implements Property {
...
}
我们可以选择具有 IntegerProperty
类型属性的 PropertyHolders
List<PropertyHolder> propertyHolders = session.createQuery(
"select p from PropertyHolder p where type(p.property) = IntegerProperty ",
PropertyHolder.class ).list();
错误修复
您可以在此处找到此版本的全部更改列表。