Questions tagged [spring-data-jdbc]

Spring Data JDBC is part of the Spring Data umbrella project which makes it easy to implement JDBC based repositories.

Spring Data JDBC Project page.

Github Repository.

Introduction into Spring Data JDBC or if you prefer video over text try this 10 minute video introduction.

The very important topic of Aggregates and its ramifications for Spring Data JDBC.

FAQ

324 questions
50
votes
4 answers

Spring Data JDBC / Spring Data JPA vs Hibernate

What are the typical real life scenarios where one would choose Spring Data JDBC / Spring Data JPA vs Hibernate? I would like to understand the scenarios where either of these implementations are best suited.
Punter Vicky
  • 15,954
  • 56
  • 188
  • 315
28
votes
1 answer

spring-jdbc vs spring-data-jdbc and what are they supporting

I'm curious what is the difference between the spring-jdbc (what I missing in the newest spring release) and spring-data-jdbc. Is there a difference or just a renaming (in the repositories I don't see this)? And is there somewhere described what…
PaulEdison
  • 897
  • 1
  • 15
  • 36
12
votes
1 answer

Composite Key and spring-data-jdbc

I have a database which is using composite keys. Is it possible to utilize spring-data-jdbc? I tried the milestone version 1.1M2 where I mapped my entity in the following way: class History { @ID @Embedded private CompositeHistoryID …
Alexander Petrov
  • 9,204
  • 31
  • 70
12
votes
1 answer

Why does Spring-data-jdbc not save my Car object?

I'm playing around with spring-data-jdbc and discovered a problem, with I can't solve using Google. No matter what I try to do, I just can't push a trivial object into the database (Bean1.java:25): carRepository.save(new Car(2L, "BMW", "5")); Both,…
bitmagier
  • 720
  • 6
  • 16
11
votes
3 answers

How to map entity to table in Spring Data JDBC?

In Spring Data JPA we can map an entity to a specific table by using @Table annotation where we can specify schema and name. But Spring Data JDBC uses a NamingStrategy to map an entity to a table name by converting the entities class name. For…
keddok
  • 531
  • 1
  • 5
  • 15
11
votes
4 answers

How to insert a record with custom id use Spring data jdbc?

For Spring Data JPA, I can use @GeneratedValue(strategy = GenerationType.AUTO) to insert a record with a custom id, but for Spring Data JDBC, how do I insert a record with custom id? I hav tried to insert with id, but no exception was thrown and the…
harrell hao
  • 111
  • 1
  • 4
9
votes
5 answers

Spring Data JDBC Firebird dialect not recognized

I'm trying to connect to Firebird database using Spring Data JDBC and Spring Boot. I've created a simple app using Spring Tools. Spring Data JDBC doesn't recognize the dialect. I believe the problem is that the DialectResolver doesn't support…
ndwd
  • 93
  • 1
  • 1
  • 3
8
votes
1 answer

Using CrudRepository.save(Entity) to insert an Entity with predefined @ID field using spring-data-jdbc

I'm using CrudRepository.save(Entity) to insert an Entity with @ID already populated. I'm getting the following exception. Caused by: org.springframework.dao.IncorrectUpdateSemanticsDataAccessException: Failed to update entity…
user3740148
  • 117
  • 1
  • 7
8
votes
7 answers

New Error in spring boot 2.3.0.RELEASE : UnsatisfiedDependencyException for Oracle 12.2.0.1 jdbcdriver but not with mysql jdbcdriver

Created a fresh boot project with just jdbc and Oracle jdbc as dependencies org.springframework.boot spring-boot-starter-data-jdbc
anjanb
  • 12,999
  • 18
  • 77
  • 106
8
votes
4 answers

Multiple DataSources using Spring Data JDBC and CrudRepository Interface

i have a not trivial question: My Case: Using Spring Data JDBC Using Two databases Usage of CrudRepository As you can see here in Spring Data JDBC you can extends CrudRepository and get with Spring all Crud Operations out of the box - without an…
user182410
  • 151
  • 2
  • 8
8
votes
1 answer

Does Spring Data JDBC support custom type converters

I have an entity that has a filed of type java.util.Date (or Timestamp, doesn't matter for the case). public class StatusReason { @Column("SRN_ID") private Long id; @Column("SRN_CREATOR") private String creator; …
Evgeni Dimitrov
  • 21,976
  • 33
  • 120
  • 145
7
votes
1 answer

Best practice of handling relations between tables in Spring Data R2dbc

I tried to create a user/roles relation in RDBMS and want to use R2dbc(Spring Data R2dbc) to shake hands with the backend database. Assume there are three tables, users, roles, and user_roles. @Table("users") class User { @Id private String…
Hantsy
  • 8,006
  • 7
  • 64
  • 109
7
votes
1 answer

How to handle compound keys with Spring Data JDBC

I'm trying to use Spring Data JDBC to access a table that has a compound key, and although I can find lots of info on how Spring Data JPA handles this, the same doesn't seem to apply to Spring Data JDBC. Can anyone give a quick example of how you…
Ozzy
  • 71
  • 1
  • 2
7
votes
1 answer

How to tweak NamingStrategy for Spring Data JDBC

how do i tweak the Spring Data JDBC NamingStrategy to behave like Hibernate´s PhysicalNamingStrategy? I have the following entity: /** * Campus domain model class. * Handles information about campus. * * @author thomas.lang@th-deg.de …
Thomas Lang
  • 1,285
  • 17
  • 35
7
votes
1 answer

Does Spring Data JDBC support joins between entities?

As I have read in the documentation, Spring Data JDBC supports query creation like Spring Data JPA For Example: findByProperty(Property property) My question : Does Spring Data JDBC support situation where we create a query and join two (or more)…
Sergey Frolov
  • 1,317
  • 1
  • 16
  • 30
1
2 3
21 22