Hibernate ORM 6.2.0.CR2 was just released with lots of goodies.
A little over a month has gone by since 6.2 CR1 was released. In that time, and even before, we’ve recieved really excellent feedback and bug reports and resolved over 100 Jira reports. Thanks for the feedback!
The code has really stabilized as the SQL AST changes smoothed out as well.
SQL MERGE for "optional table" updates
Building on top of the SQL AST, Hibernate can now use the SQL MERGE
command to handle updates against optional tables.
An update to an optional table will have one of 3 ultimate outcomes:
-
if there is no corresponding row already in the table, insert the row
-
else if all the new "value" columns are null, delete the row
-
else update the row
The legacy behavior was to just do these if-checks ourselves at runtime and execute the insert, update and delete statements individually.
The MERGE
command allows that to happen more efficiently in a single JDBC call.
Currently this is supported on:
The fall back is to just use the legacy behavior.
Proprietary SQL types
Dealing with certain SQL types requires access to JDBC driver specific classes in order to properly read and write values of that type. In some environments (various containers, e.g.), those classes are not available to Hibernate.
Hibernate better handles these situations now when it can, usually based on casts to more standardized types. For example, we might read a JSON value from a ResultSet as a String by wrapping the JSON expression in a cast function.
Community
For additional details, see:
-
the User Guide
-
the Migration Guide
-
the release page
-
the internals report
See the website for getting in touch with us.