Hibernate 6.4.0.CR1

Posted by    |       Hibernate ORM Releases

6.4 adds some cool new features, in addition to many improvements and fixes.

Soft Delete

6.4 adds support for soft deletes using the new @SoftDelete annotation.

@Entity
@SoftDelete
class Account {
        ...
}

Dealing with values as deleted/non-deleted versus active/inactive (reversed) is simple using an annotation attribute:

@Entity
@SoftDelete(strategy=ACTIVE)
class Account {
        ...
}

It even supports pluggable converters for dealing with what gets stored in the database.

See the User Guide for details.

HQL/Criteria Array Functions

Following up on earlier work, 6.4 adds the remaining functions for handling arrays in HQL and Criteria queries, including -

array()

Creates an array based on the passed arguments - e.g. array(1,2,3)

array_position()

Determines the position of an element in an array - e.g. where array_position(an.array,'x') = 1

array_length()

Determines the length of an array - e.g. where array_length(an.array) > 50

array_get()

Accesses the element of an array by index - e.g. where array_get(an.array, 1) <> 13

array_slice()

Creates a sub-array of the given array based on lower and upper index - e.g. array_slice(an.array,3,6)

array_contains()

Whether an array contains an element - e.g. array_contains(an.array, 1)

And others…​ See the Query Guide for excellent coverage of these functions.

These functions are still incubating and some things (names, etc) may change before Final.

Java Flight Recorder Events

CR1 contains support for producing a small number of Java Flight Recorder (JFR) events as a proof of concept. This works on many JDKs, but we recently discovered that not all JDKs support the JFR package despite being part of Open JDK.

Long story short,

  • If your JDK does support JFR, CR1 produces some Hibernate-specific events

  • If your JDK does not support JFR, CR1 will not work for you.

We will decide how to proceed, before 6.4 Final.

Non-String Tenant Id

6.4 adds support for using tenant-id with types other than String.

P.S.

For additional details, see:

See also the following resources related to supported APIs:

Visit the website for details on getting in touch with us.


Back to top