Today, we published a new maintenance release of Hibernate ORM 6.1: 6.1.2.Final.

What’s new

This release introduces a few minor improvements as well as bug fixes.

@Any mapping and HQL function type(…​)

It is now possible to use the HQL function type(…​) to access the type of a polymorphic association.

E.g.

    @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 {
        ...
    }

we can select the PropertyHolders having a property of type IntegerProperty

List<PropertyHolder> propertyHolders = session.createQuery(
    "select p from PropertyHolder p where type(p.property) = IntegerProperty ",
    PropertyHolder.class ).list();

Bugfixes

You can find the full list of changes in this version here.

Conclusion

For additional details, see:

Feedback, issues, ideas?

To get in touch, use the usual channels:


Back to top