This project provides a custom Hibernate dialect that allows you to integrate Hibernate ORM with Yandex Database (YDB). This enables you to take advantage of Hibernate's powerful ORM features while using YDB as your underlying database.
- Full CRUD (Create, Read, Update and Delete) support for YDB.
- Custom type mappings to utilize YDB's data types.
- Support for YDB-specific features and functions.
To use this Hibernate YDB Dialect, you'll need:
- Java 17 or above.
- Hibernate version 6+
- YDB JDBC Driver
- Access to a YDB Database instance
For Maven, add the following dependency to your pom.xml:
<dependency>
<groupId>tech.ydb.dialects</groupId>
<artifactId>hibernate-ydb-dialect</artifactId>
<!-- Set actual version -->
<version>${hibernate.ydb.dialect.version}</version>
</dependency>
For Gradle, add the following to your build.gradle (or build.gradle.kts):
dependencies {
implementation 'tech.ydb.dialects:hibernate-ydb-dialect:$version' // Set actual version
}
Configure Hibernate to use the custom YDB dialect by updating your hibernate.cfg.xml:
<property name="hibernate.dialect">tech.ydb.hibernate.dialect.YdbDialect</property>
Or, if you are using programmatic configuration:
public static Configuration basedConfiguration() {
return new Configuration()
.setProperty(AvailableSettings.DRIVER, YdbDriver.class.getName())
.setProperty(AvailableSettings.DIALECT, YdbDialect.class.getName());
}
Use this custom dialect just like any other Hibernate dialect. Map your entity classes to database tables and use Hibernate's session factory to perform database operations.
Configure Spring Data JPA with Hibernate to use custom YDB dialect by updating your application.properties:
spring.jpa.properties.hibernate.dialect=tech.ydb.hibernate.dialect.YdbDialect
spring.datasource.driver-class-name=tech.ydb.jdbc.YdbDriver
spring.datasource.url=jdbc:ydb:grpc://localhost:2136/local
An example of a simple Spring Data JPA repository can be found at the following link.
For support, you can open issues in the repository issue tracker with tag hibernate-v6
.