I like the approach of spring-data-jdbc very much, but it seems it does not have support for Oracle. https://docs.spring.io/spring-data/jdbc/docs/2.0.1.RELEASE/reference/html/#requirements Is it possible to manage with Mybatis all what can be done with spring-data-jdbc by using Mybatis support in spring-data-jdbc. Essentially, I like to keep the design approach and domain driven approach of spring-data-jdbc and use Mybatis in spring-data-jdbc. This way, I can start leveraging spring-data-jdbc apis and approach till Orcale is supported. Or it will be better for me to stick with plain Mybatis and not use Mybatis and spring-data-jdbc at this point.
Asked
Active
Viewed 1,872 times
3
-
Can you please point to documentation where it says Oracle is not supported or list of supported databases? I think it supports Oracle. – Smile Jun 21 '20 at 14:33
-
edited the refeference - https://docs.spring.io/spring-data/jdbc/docs/2.0.1.RELEASE/reference/html/#requirements – cloud-enterprise-arch Jun 21 '20 at 15:08
-
Thanks for sharing the documentation. Did you try the [Custom Dialect](https://docs.spring.io/spring-data/jdbc/docs/2.0.1.RELEASE/reference/html/#jdbc.dialects) approach? – Smile Jun 21 '20 at 15:16
-
https://github.com/springframeworkguru/springbootwebapp/blob/spring-boot-oracle/src/main/resources/application.properties – cloud-enterprise-arch Jun 21 '20 at 15:26
-
@Smile I am not familiar with custom dialects and have not tried yet. It seems Oracle dialect as as shown below is for hibernate dialect, hence the question. spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect spring.jpa.hibernate.ddl-auto=create-drop https://github.com/springframeworkguru/springbootwebapp/blob/spring-boot-oracle/src/main/resources/application.properties – cloud-enterprise-arch Jun 21 '20 at 15:33
3 Answers
0
If you are interested in using Spring Data JDBC with Oracle I'd just go ahead and do it by implementing a Dialect
.
People have used it with Oracle before a Dialect
was required.
You will probably encounter features that don't work yet, but should be able to work around them with annotated queries, some RowMappers
and occasionally a custom method implementation.

Jens Schauder
- 77,657
- 34
- 181
- 348
0
Can you not use 2.2.6.RELEASE or 2.3.0.RELEASE of Spring Data? It does support Oracle. The following dependencies works well.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.6.0.0</version>
</dependency>
</dependencies>

Nirmala
- 1,278
- 1
- 10
- 11
-
You are using the wrong starter. The correct one is `spring-boot-starter-data-jdbc` https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jdbc. The one you use will give you things like the `JdbcTemplate`, but not the `Repository` abstraction. Also 2.3.0 in this example is the version of Spring Boot, not the one of Spring Data. – Jens Schauder Jun 24 '20 at 06:06
0
I just set a simple example with the Oracle DB and Spring Data JDBC and Spring Data JPA and it worked ok (no need for Dialect either). Could you give more information about your case? Or you assume is not supported because is not listed in the link you shared?

Pablo Silberkasten
- 16
- 1