Kotlin JDSL: Let's use Kotlin to easily write reactive Criteria API

Click for: original source

In this post, we’ll be looking at Kotlin JDSL Reactive modules. While many of you might have a preconceived notion that JPA cannot be reactive, Hibernate released a reactive JPA library called Hibernate Reactive. By Hyunsik Kang.

Before the release of Hibernate Reactive, we used R2DBC as there were no existing reactive libraries for JPA. However, R2DBC doesn’t support object relations and automatic change detection, which are some of JPA’s greatest advantages. Simply put, R2DBC is basically an SQL mapper. If you can’t use R2DBC, you can use Reactor with synchronous JPA as an alternative.

The main sections of the article:

  • Introducing Hibernate Reactive
  • Things to improve on Hibernate Reactive
  • Introducing Kotlin JDSL Reactive
  • The classes and interfaces required for generating reactive queries
  • Kotlin JDSL Reactive vs Hibernate Reactive

Hibernate Reactive is quite difficult to use because of the inherent characteristics of the asynchronous code in Criteria API and Hibernate Reactive. Kotlin JDSL Reactive was designed to improve upon these shortcomings. Good read!

[Read More]

Tags programming kotlin functional-programming jvm apis