-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: support for Hibernate reactive #2211
Comments
Hibernate Reactive isn't using the JPA API, rather they introduced new API that is specific to Hibernate. If you're looking for reactive SQL support, take a look at Spring Data R2DBC that integrates with reactive drivers following the R2DBC standard. |
Thanks @mp911de for your answer. I didn't know they defined a new API. I found it very promising because we already have a big knowledge around regular Hibernate, but we are moving to reactive programing. The problem is that RD2BC has some missing features like lazy loading, support for association like one-to-many, caching and more. |
Support for Hibernate Reactive would have been very nice |
+1, supporting Hibernate Reactive would be nice, since R2DBC does not support QueryDSL yet. |
+1 , the big advantage is the support of the JPA mapping. The reactive session API is not JPA compliant but it does not matter since spring data is an abstraction on top of it. However it would be a new spring data module. Hibernate reactive uses Mutiny but a converter helps expose
It also uses vert.x database driver. It results in two event loops if used with spring-webflux but not with Query by example and derived queries handling could be taken from spring-data-jpa (except operation that involves a count query). The tests use postgresql (docker-compose.yml included in the project). Only the delete by entity and entities fails since Lazy loading is obviously not supported but For lazy relations, an interesting feature could be : Mono<T> findById(ID id, String... relationsToFetch); Usage : Mono<Blog> mono = repository.findById(1, "posts"); Since Mono<T> findById(ID id, Function<T, ?>... relationsToFetch); Usage : Mono<Blog> mono = repository.findById(1, x -> x.getPosts()); However loading 1-n and n-n relations in a single query results in n lines returned from the database (and Cartesian product if several 1-n or n-n relations are fetched). |
@ah1508 I have added Mutiny support to Spring framework and Spring Data Commons, so you can use Mutiny in Spring directly, no need conversion explicitly, but Spring Data Commons did not accept the Mutiny variants of the Repository interface. Hibernate Reactive reused the annotations of JPA, for most of Java developers who are familiar with the Hibernate Session or JPA EntityManager, in contrast to using(or learn) Spring Data R2dbc, the cost is lower when migrating to Hibernate Reactive. Compared to the existing Hibernate support in Spring, when adding Hibernate Reactive the biggest challenge is providing a reactive SessionFactoryBean instead, and also should support Reactive transaction. Then implementing the Spring Data Repository support. |
My example project for adding Hibernate Reactive to Spring manually, https://itnext.io/integrating-hibernate-reactive-with-spring-5427440607fe. |
Hibernate Reactive is not against introducing R2DBC into their codebase but are not willing to put in the work themselves to do that. However, they added an extension point that allows users to experiment with integrating alternative reactive database drivers. |
Is there any plan to support Hibernate Reactive project working with the Vert.x Reactive DB driver
We started a project using this stack and Spring boot, but it will be very valuable to be able to use also spring-data.
Thanks
The text was updated successfully, but these errors were encountered: