Skip to content

Commit

Permalink
feat: Spring Data JDBC added README.md and run examples
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillKurdyukov committed Aug 30, 2024
1 parent 18865cc commit e17cb0d
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 20 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci-spring-data-jdbc-ydb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ jobs:
working-directory: ./spring-data-jdbc-ydb
run: mvn $MAVEN_ARGS install

# - uses: actions/checkout@v4
# with:
# repository: ydb-platform/ydb-java-examples
# ref: master
# path: examples
#
# - name: Download dependencies
# working-directory: ./examples/jdbc/spring-data-jpa-v5
# run: mvn $MAVEN_ARGS -Dspring.data.jdbc.ydb.dialect.version=$SPRING_DATA_JDBC_DIALECT_VERSION dependency:go-offline
#
# - name: Test examples with Maven
# working-directory: ./examples/jdbc/spring-data-jpa-v5
# run: mvn $MAVEN_ARGS -Dspring.data.jdbc.ydb.dialect.version=$SPRING_DATA_JDBC_DIALECT_VERSION test
- uses: actions/checkout@v4
with:
repository: ydb-platform/ydb-java-examples
ref: master
path: examples

- name: Download dependencies
working-directory: ./examples/jdbc/spring-data-jdbc
run: mvn $MAVEN_ARGS -Dspring.data.jdbc.ydb.version=$SPRING_DATA_JDBC_DIALECT_VERSION dependency:go-offline

- name: Test examples with Maven
working-directory: ./examples/jdbc/spring-data-jpa-v5
run: mvn $MAVEN_ARGS -Dspring.data.jdbc.ydb.version=$SPRING_DATA_JDBC_DIALECT_VERSION test
Empty file removed hibernate-dialect/NOTES.md
Empty file.
5 changes: 0 additions & 5 deletions hibernate-dialect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ 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](https://github.com/ydb-platform/ydb-java-examples/tree/master/jdbc/spring-data-jpa).

## Known Limitations

In the section [NOTES.md](./NOTES.md), we list all the current dialect limitations
and provide solutions to them.

## Support and Contact

For support, you can open issues in the repository issue tracker with tag `hibernate-v6`.
5 changes: 5 additions & 0 deletions spring-data-jdbc-ydb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.9.1 ##

- Supported VIEW INDEX statement from @ViewIndex
- YdbDialect fully supports YQL
- Supported specific @YdbType
74 changes: 74 additions & 0 deletions spring-data-jdbc-ydb/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,75 @@
# YDB Spring Data JDBC Dialect

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-java-dialects/blob/main/LICENSE.md)
[![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Ftech%2Fydb%2Fdialects%2Fspring-data-jdbc-ydb%2Fmaven-metadata.xml)](https://mvnrepository.com/artifact/tech.ydb.dialects/spring-data-jdbc-ydb)
[![CI](https://img.shields.io/github/actions/workflow/status/ydb-platform/ydb-java-dialects/ci-spring-data-jdbc-ydb.yaml?branch=main&label=CI)](https://github.com/ydb-platform/ydb-java-dialects/actions/workflows/ci-spring-data-jdbc-ydb.yaml)

## Overview

This project is an extension for Spring Data JDBC
that provides support for working with [YDB](https://ydb.tech).

### Features

- Full support for basic operations with Spring Data JDBC
- Supported VIEW INDEX statement from @ViewIndex annotation on method your Repository
- @YdbType explicitly specifies the YDB data type (Json example in String type)

## Getting Started

### Requirements

To use this Spring Data JDBC YDB Dialect, you'll need:

- Java 17 or above.
- Spring Data JDBC 3+
- [YDB JDBC Driver](https://github.com/ydb-platform/ydb-jdbc-driver)
- Access to a YDB Database instance

### Installation

For Maven, add the following dependency to your pom.xml:

```xml
<dependency>
<groupId>tech.ydb.dialects</groupId>
<artifactId>spring-data-jdbc-ydb</artifactId>
<!-- Set actual version -->
<version>${spring.data.jdbc.ydb.version}</version>
</dependency>
```

For Gradle, add the following to your build.gradle (or build.gradle.kts):

```groovy
dependencies {
implementation 'tech.ydb.dialects:spring-data-jdbc-ydb:$version' // Set actual version
}
```

## Usage

Use this custom dialect just like any other DBMS.

## Configuration

Configure Spring Data JDBC with YDB by updating your application.properties:

```properties
spring.datasource.driver-class-name=tech.ydb.jdbc.YdbDriver
spring.datasource.url=jdbc:ydb:grpc://localhost:2136/local
```

Java configuration for @YdbType annotation:

```java
@Import(AbstractYdbJdbcConfiguration.class)
public class YdbJdbcConfiguration {}
```

An example of a simple Spring Data JDBC repository can be found at the following
[link](https://github.com/ydb-platform/ydb-java-examples/tree/master/jdbc/spring-data-jdbc).

## Support and Contact

For support, you can open issues in the repository issue tracker with tag `spring-data-jdbc`.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tech.ydb.data;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.jdbc.repository.config.EnableJdbcAuditing;
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
import tech.ydb.data.repository.config.AbstractYdbJdbcConfiguration;
Expand All @@ -11,5 +12,5 @@
@Configuration
@EnableJdbcRepositories
@EnableJdbcAuditing
public class YdbJdbcConfiguration extends AbstractYdbJdbcConfiguration {
}
@Import(AbstractYdbJdbcConfiguration.class)
public class YdbJdbcConfiguration {}

0 comments on commit e17cb0d

Please sign in to comment.