hibernate-orm
hibernate-orm copied to clipboard
Add a dialect for YugabyteDB
YugabyteDB is a cloud-native database, compatible with Postgresql. We want to add a dialect for YugabyteDB for a better integration with Hibernate for the community.
Please let me know if I need to file a ticket for this first.
This is a draft PR since I would like an early feedback on the changes itself and also because I am facing issues running some tests appropriately which I need help with:
- Every time I run
./gradlew test -Pdb=yugabytedb, I see tests running from different modules. Does this need to be configured specifically for a dialect? - When I run individual tests from
hibernate-core, all of them - except one or two - run fine. But with above command there are quite a few failures, suggesting the tests may be running in parallel. Is it really the case? If yes, how do I change this? - A newly added test class
YugabyteDBQueryHintTest(still needs changes) shows up as ignored even when run individually. How do I avoid getting it ignored?
Thanks in advance!
Thanks for your pull request!
This pull request does not follow the contribution rules. Could you have a look?
❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
↳ Offending commits: [eeb9d6e64eee744ae845755fc86209328434147f]
› This message was automatically generated.
Thanks @beikov for the review comments! I was on a short break hence the delay in responding to these. Will go through the comments.
Hi @beikov, firstly thanks for your patience and great comments/suggestions!
There were primarily two reasons why we wanted to contribute a Hibernate dialect for YugabyteDB:
- There was no support for query hints in Postgresql dialect.
- A
ClassNotFoundExceptionissue was seen while using our custom driver, when certain types (like JSONB, INET, etc) were used.
For 1): We see that the query hint support is now added recently in the PostgreSQLDialect.
For 2): This was seen because, in our driver, we rename org.postgresql.* package to com.yugabyte.* to avoid conflicts and Hibernate was trying to load org.postgresql.util.PGobject.
Even this, I've realised bit late, seems to have been fixed in the latest Hibernate release (6.3), by providing separate JdbcType classes for them (PostgreSQLCastingJsonJdbcType, PostgreSQLCastingInetJdbcType, etc).
Please correct me if I misunderstood anything.
With this, there is no longer a need to have a separate dialect for YugabyteDB for now and we can close this PR.
With this, there is no longer a need to have a separate dialect for YugabyteDB for now and we can close this PR.
You're in the same boat as Enterprise DB with their own JDBC driver variant then. I think it's worth adding a special dialect variant for YugabyteDB just like we do for Enterprise DB, especially because your server implementation is probably not a 100% PostgreSQL + extension, which means there may be the need for some customizations. One such customization is the use of a custom PgJdbcHelper variant to register specialized JdbcType for that driver.
Ultimately it's up to you though. This is a community dialect and you have to maintain it, so you can decide how you want to proceed with this.
Closing since you don't seem to have interest in finishing this PR anymore.