hibernate-reactive icon indicating copy to clipboard operation
hibernate-reactive copied to clipboard

Add support for H2

Open DavideD opened this issue 3 years ago • 10 comments

For testing and examples, it would be nice to have support for an in-memory database like H2.

There is actually an example in the Vert.x SQL Client documentation on how to wrap the H2 JDBC driver around the Vert.x Pool: https://vertx.io/docs/vertx-jdbc-client/java/#_using_the_sql_client_api

DavideD avatar Aug 04 '21 12:08 DavideD

@blafond, @DavideD Hello. I am a developer of kotlin-jdsl. Hibernate-reactive does not officially support h2 db, so I went in after seeing the above issue and changed the settings to test internally using h2 db. I hope it will be helpful for your development.

For reference, when I run h2 db in hibernate-reactive, I have summarized the following problems and the progress to solve them.

  1. Schema generation is not possible because h2 db is not supported.
  2. There was no db pool, but VertxH2DBConnectionPoolConfiguration solved using code
  3. In case 1, it induces query generation using the existing hibernate-core's ddl schema generator syntax - Since h2 db itself is not supported, it is modified to operate in mysql mode.

please note. We expect to support H2 DB quickly. I tried to contribute, but it was a lot more work than I expected, so I'm sharing the difficulties I've been through.

Thank you for making such a good library, I'm using it well.

cj848 avatar Mar 20 '22 22:03 cj848

Thanks @cj848, we are currently working on it. Not sure at the moment how long is gonna take to support h2 because we often need some additional work to make the Hibernate ORM Dialect works with the Vert.x driver. We might be able have something working (with some limitations) in the next couple of weeks.

Anyway, people seems very interested to this feature so we will try to keep it up to date.

Cheers

DavideD avatar Mar 20 '22 23:03 DavideD

@DavideD Thank you for your interest. I am using this library in a reactive module inside a library called kotlin-jdsl as in the link in the previous comment. I am very grateful that I can use reactive while using the features of JPA as it is. All of the hibernate-reactive contributors worked hard in the development. thank you

cj848 avatar Mar 20 '22 23:03 cj848

We stopped working on this one because the results were unstable. When we have time we should have another look at it

DavideD avatar Jun 10 '22 13:06 DavideD

@blafond we should push this upstream under wip/h2 so that other people might have a look

DavideD avatar Jun 10 '22 13:06 DavideD

We stopped working on this one because the results were unstable. When we have time we should have another look at it

Just out of curiosity, what kind of instability was that? :smile:

mkouba avatar Jun 10 '22 14:06 mkouba

Every time we run the build different tests fail or work.

DavideD avatar Jun 10 '22 14:06 DavideD

Every time we run the build different tests fail or work.

I see. That's not good. Thanks for sharing.

mkouba avatar Jun 11 '22 08:06 mkouba

@blafond rebased it to the latest changes and now it seems to work as expected. I will fix some of the tests that are failing and see if we can send a PR.

DavideD avatar Jun 13 '22 16:06 DavideD

We stopped working on this one because the results were unstable. When we have time we should have another look at it

It turns out that I'm not very smart and didn't realize that we were using the wron URL. The current PR looks promising: https://github.com/hibernate/hibernate-reactive/pull/1336

DavideD avatar Jun 14 '22 14:06 DavideD