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
6
votes
2 answers

R2DBC vs Spring Jdbc Vs Spring Data JDBC?

On Using Spring JDBC which works very well and has some improvements over JPA when using Batch processing. I would love to learn why to use Spring Data JDBC when you already have Spring JDBC. I would love to learn why to use R2DBC when you already…
Jeff Cook
  • 7,956
  • 36
  • 115
  • 186
6
votes
6 answers

How to specify table schema in spring-data-jdbc

In my project, I use spring-data-jdbc version 2.0.4.RELEASE and I'm stuck with the problem of how to specify a schema for a table. The entity class looks like this @Data @Table(value = "alpha.op_organization") public class OrganizationEntity { …
MadMax
  • 153
  • 1
  • 9
6
votes
1 answer

How to read/write postgres jsonb type with spring-data-jdbc?

I'm trying to use the following with spring-data-jdbc and postgres driver (kotlin), data class MyEntity( val id: UUID, val content: String ) using a string fails with the following error, org.postgresql.util.PSQLException: ERROR: column…
6
votes
1 answer

How is spring-data-jdbc complimenting MyBatis?

I would like to understand why is spring-data-jdbc providing integration to MyBatis. What problem is it solving? How is spring-data-jdbc complimenting MyBatis. Is it just a question of conforming the Mapper to Repository or it goes beyond that.…
6
votes
1 answer

OneToMany Spring Data JDBC

I want to model a OneToMany Relation with Spring Data JDBC. I´ve read on this very useful blog https://spring.io/blog/2018/09/24/spring-data-jdbc-references-and-aggregates that you should use references when you want to model ToMany Reference: …
Thomas Lang
  • 1,285
  • 17
  • 35
6
votes
1 answer

PagingAndSortingRepository methods throw error when used with spring data jdbc

All the CRUD methods related to the CrudRepository are working as intended but when trying to use the findAll with paging or sorting an error is thrown. I am using the Lovelace-SR2 release train. The class only has one field which is the @Id.…
Scott
  • 135
  • 2
  • 8
5
votes
1 answer

Designing one-to-one and one-to-many relationships in Spring Data R2DBC

I am exploring possible ideas when it comes to designing the one-to-one and one-to-many relationships while using Spring Data R2DBC. As Spring Data R2DBC still do not support relationships natively there is still a need to handle those on our own…
Lisek
  • 753
  • 2
  • 11
  • 31
5
votes
1 answer

Using jsonb postgres format into Spring data jdbc

I have the following test table: CREATE TABLE user ( id UUID NOT NULL PRIMARY KEY DEFAULT uuid_generate_v4(), name VARCHAR(100), address jsonb ) What I want to do is loading this table into an entity public class Buddy{ @Id private UUID…
Paolo bi
  • 141
  • 2
  • 10
5
votes
1 answer

Is there a Criteria API for Spring Data JDBC?

since i can't find anything in the docs and the information out there seems to be restricted - what is the best way to achieve functionality equal to the Criteria API from spring data in Spring Data JDBC? Is there any alternative or do i have to…
leurer
  • 441
  • 3
  • 10
5
votes
2 answers

Can I do pagination with spring-data-jdbc?

I would like to use PagingAndSortingRepository with spring-data-jdbc but it not seem to work. It's only available with JPA ? I tried to use PagingAndSortingRepository and use the findAll(Pageable pageable). But I actually get a "No query specified…
MarS
  • 74
  • 2
  • 9
4
votes
1 answer

How to set fetch-size in Spring-Data-JDBC

I use Spring-Data-JDBC (not JPA) and want to set the fetch-size. I know that the the classic org.springframwork.jdbc.core.JdbcTemplate has a setFetchSize(int) method, but I have Spring-Data-JDBC…
Ralph
  • 118,862
  • 56
  • 287
  • 383
4
votes
1 answer

How to filter certain records for all database operations in Spring Boot

I'm trying to create an API to retrieve records from a database with Spring Boot Data JDBC. Say I have the following entity: record Customer(@Id Long id, String name) {} and the following repository: public interface CustomerRepository extends…
MC Emperor
  • 22,334
  • 15
  • 80
  • 130
4
votes
1 answer

Why can't I query by reference with Spring Data Jdbc?

I created a query method using a Reference from another Aggregate. @Getter @AllArgsConstructor(access = AccessLevel.PRIVATE, onConstructor_=@PersistenceConstructor) public static class Book { public static Book of(Author author) { …
Wansu yang
  • 66
  • 4
4
votes
3 answers

spring-data-jdbc deleteBy method return extraordinary result type

I try declare and use deleteBy method with spring-data-jdbc repositories like this public interface TokenRepository extends CrudRepository { void deleteByBreed(Long breed); } When i tried to call method private TokenRepository…
MadMax
  • 153
  • 1
  • 9
4
votes
1 answer

Is there a way with spring data jdbc avoid n+1 issue?

When I run this query, I experience n+1 issue where data JDBC fetches all the related entities of the campaign objects. Is there any way to avoid this using data JDBC? @Query( """ SELECT campaign.* FROM campaign JOIN targeting ON…
Said K.
  • 43
  • 5
1
2
3
21 22