Hibernate Reactive is a reactive API for Hibernate ORM, supporting non-blocking database drivers and a reactive style of interaction with the database. For more information, see Hibernate Reactive on hibernate.org.

Both are compatible with Hibernate ORM 8.0.0.CR1. They differ in the version of the Vert.x SQL client:

  • Hibernate Reactive 5.1.0.CR2 is compatible with Vert.x SQL client 5.2.3;

  • Hibernate Reactive 5.0.0.CR2 is compatible with Vert.x SQL client 5.1.10.

5.0.0.CR2 is the last release of Hibernate Reactive 5.0 before 5.0.0.Final, which will also be the last release of the series: after it, 5.0 reaches its end of life, and we’ll focus our efforts on 5.1. If you are using Hibernate Reactive 5.0, we recommend that you plan the upgrade to 5.1 and Vert.x 5.2.

CR2 contains a single bug fix: in 5.1.0.CR1 and 5.0.0.CR1, table generators could cause a deadlock when the session holding the lock on the row of the generator table needed a new block of ids (#4538). If you use 5.1.0.CR1 or 5.0.0.CR1 with a @TableGenerator, or with a sequence emulated with a table (for example, @GeneratedValue on MySQL), please upgrade.

We released CR1 last week without announcing it, so this post also covers what’s new in CR1, compared to 5.1.0.Beta1 and 5.0.0.Beta3.

You can find what’s new in Hibernate ORM in the Hibernate ORM 8.0.0.CR1 announcement.

If you need a Hibernate Reactive version compatible with older Hibernate ORM releases or Vert.x releases, you can find a compatibility matrix on the Hibernate website.

What’s new

These changes are in CR1. 5.1 and 5.0 contain the same changes, except for the support of JSON on Oracle and SQL Server, which is only in 5.1.

Transactions marked for rollback only are rolled back

In Hibernate ORM, when an operation fails, the transaction is marked for rollback only: even if the application recovers from the failure, the transaction is rolled back instead of committed. Hibernate Reactive now does the same: withTransaction() rolls back a transaction marked for rollback only, and fails with a RollbackException when JPA transaction compliance is enabled. Transaction#isMarkedForRollback() reports it.

Like in Hibernate ORM, a NoResultException thrown by getSingleResult() doesn’t mark the transaction for rollback, so you can still recover from it. See #4448.

Creating Vert.x with other options

With the new setting hibernate.vertx.factory, you can name a VertxFactory that the default VertxInstance uses to create Vert.x, for example to enable metrics with VertxOptions, without implementing a whole VertxInstance. The rest of the behaviour doesn’t change: Hibernate Reactive still uses the Vert.x instance of the current context if there is one, and closes only the instance it creates. See #4491.

Extended pessimistic lock scope

With PessimisticLockScope.EXTENDED, Hibernate Reactive now also locks the rows of the element collections and join tables owned by the locked entities, like Hibernate ORM 8.0, for find(), queries, refresh() and lock(). With LockMode.PESSIMISTIC_FORCE_INCREMENT, the version is incremented after the collection tables are locked. Before, the extended scope was treated like the normal one. See #4515.

JSON

  • JSON arrays, for example a List mapped to a JSON column, now work (#4156).

  • JSON columns now work on MariaDB (#1529).

  • Hibernate Reactive 5.1 supports the JSON mappings on Oracle and SQL Server too (#4450).

The documentation now lists the column type used by each JSON mapping on each database.

If you are upgrading from Hibernate Reactive 4.x, check the migration guide.

The full list of changes, including the bug fixes, is available on GitHub in the milestones of 5.1.0.CR1, 5.1.0.CR2, 5.0.0.CR1 and 5.0.0.CR2.

How can I get it?

All details are available on the Hibernate Reactive website releases page, for 5.1 and 5.0.

If you are new to Hibernate Reactive, the official documentation is a good place to start.

Feedback, issues, ideas?

To get in touch, you can use the following channels:


Back to top