Skip to content

Commit e17cb0d

Browse files
feat: Spring Data JDBC added README.md and run examples
1 parent 18865cc commit e17cb0d

File tree

6 files changed

+95
-20
lines changed

6 files changed

+95
-20
lines changed

.github/workflows/ci-spring-data-jdbc-ydb.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ jobs:
4646
working-directory: ./spring-data-jdbc-ydb
4747
run: mvn $MAVEN_ARGS install
4848

49-
# - uses: actions/checkout@v4
50-
# with:
51-
# repository: ydb-platform/ydb-java-examples
52-
# ref: master
53-
# path: examples
54-
#
55-
# - name: Download dependencies
56-
# working-directory: ./examples/jdbc/spring-data-jpa-v5
57-
# run: mvn $MAVEN_ARGS -Dspring.data.jdbc.ydb.dialect.version=$SPRING_DATA_JDBC_DIALECT_VERSION dependency:go-offline
58-
#
59-
# - name: Test examples with Maven
60-
# working-directory: ./examples/jdbc/spring-data-jpa-v5
61-
# run: mvn $MAVEN_ARGS -Dspring.data.jdbc.ydb.dialect.version=$SPRING_DATA_JDBC_DIALECT_VERSION test
49+
- uses: actions/checkout@v4
50+
with:
51+
repository: ydb-platform/ydb-java-examples
52+
ref: master
53+
path: examples
54+
55+
- name: Download dependencies
56+
working-directory: ./examples/jdbc/spring-data-jdbc
57+
run: mvn $MAVEN_ARGS -Dspring.data.jdbc.ydb.version=$SPRING_DATA_JDBC_DIALECT_VERSION dependency:go-offline
58+
59+
- name: Test examples with Maven
60+
working-directory: ./examples/jdbc/spring-data-jpa-v5
61+
run: mvn $MAVEN_ARGS -Dspring.data.jdbc.ydb.version=$SPRING_DATA_JDBC_DIALECT_VERSION test

hibernate-dialect/NOTES.md

Whitespace-only changes.

hibernate-dialect/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ spring.datasource.url=jdbc:ydb:grpc://localhost:2136/local
8989
An example of a simple Spring Data JPA repository can be found at the following
9090
[link](https://github.com/ydb-platform/ydb-java-examples/tree/master/jdbc/spring-data-jpa).
9191

92-
## Known Limitations
93-
94-
In the section [NOTES.md](./NOTES.md), we list all the current dialect limitations
95-
and provide solutions to them.
96-
9792
## Support and Contact
9893

9994
For support, you can open issues in the repository issue tracker with tag `hibernate-v6`.

spring-data-jdbc-ydb/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## 0.9.1 ##
2+
3+
- Supported VIEW INDEX statement from @ViewIndex
4+
- YdbDialect fully supports YQL
5+
- Supported specific @YdbType

spring-data-jdbc-ydb/README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,75 @@
11
# YDB Spring Data JDBC Dialect
2+
3+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-java-dialects/blob/main/LICENSE.md)
4+
[![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)
5+
[![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)
6+
7+
## Overview
8+
9+
This project is an extension for Spring Data JDBC
10+
that provides support for working with [YDB](https://ydb.tech).
11+
12+
### Features
13+
14+
- Full support for basic operations with Spring Data JDBC
15+
- Supported VIEW INDEX statement from @ViewIndex annotation on method your Repository
16+
- @YdbType explicitly specifies the YDB data type (Json example in String type)
17+
18+
## Getting Started
19+
20+
### Requirements
21+
22+
To use this Spring Data JDBC YDB Dialect, you'll need:
23+
24+
- Java 17 or above.
25+
- Spring Data JDBC 3+
26+
- [YDB JDBC Driver](https://github.com/ydb-platform/ydb-jdbc-driver)
27+
- Access to a YDB Database instance
28+
29+
### Installation
30+
31+
For Maven, add the following dependency to your pom.xml:
32+
33+
```xml
34+
<dependency>
35+
<groupId>tech.ydb.dialects</groupId>
36+
<artifactId>spring-data-jdbc-ydb</artifactId>
37+
<!-- Set actual version -->
38+
<version>${spring.data.jdbc.ydb.version}</version>
39+
</dependency>
40+
```
41+
42+
For Gradle, add the following to your build.gradle (or build.gradle.kts):
43+
44+
```groovy
45+
dependencies {
46+
implementation 'tech.ydb.dialects:spring-data-jdbc-ydb:$version' // Set actual version
47+
}
48+
```
49+
50+
## Usage
51+
52+
Use this custom dialect just like any other DBMS.
53+
54+
## Configuration
55+
56+
Configure Spring Data JDBC with YDB by updating your application.properties:
57+
58+
```properties
59+
spring.datasource.driver-class-name=tech.ydb.jdbc.YdbDriver
60+
spring.datasource.url=jdbc:ydb:grpc://localhost:2136/local
61+
```
62+
63+
Java configuration for @YdbType annotation:
64+
65+
```java
66+
@Import(AbstractYdbJdbcConfiguration.class)
67+
public class YdbJdbcConfiguration {}
68+
```
69+
70+
An example of a simple Spring Data JDBC repository can be found at the following
71+
[link](https://github.com/ydb-platform/ydb-java-examples/tree/master/jdbc/spring-data-jdbc).
72+
73+
## Support and Contact
74+
75+
For support, you can open issues in the repository issue tracker with tag `spring-data-jdbc`.

spring-data-jdbc-ydb/src/test/java/tech/ydb/data/YdbJdbcConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package tech.ydb.data;
22

33
import org.springframework.context.annotation.Configuration;
4+
import org.springframework.context.annotation.Import;
45
import org.springframework.data.jdbc.repository.config.EnableJdbcAuditing;
56
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
67
import tech.ydb.data.repository.config.AbstractYdbJdbcConfiguration;
@@ -11,5 +12,5 @@
1112
@Configuration
1213
@EnableJdbcRepositories
1314
@EnableJdbcAuditing
14-
public class YdbJdbcConfiguration extends AbstractYdbJdbcConfiguration {
15-
}
15+
@Import(AbstractYdbJdbcConfiguration.class)
16+
public class YdbJdbcConfiguration {}

0 commit comments

Comments
 (0)