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
3
votes
1 answer

Use spring-data-rest without jpa but only JdbcTemplate

Is it possible to use spring-data-rest without spring-data-jpa? In my application I use JdbcTemplate. Can this be wired to spring-data-rest somehow? Update from 4 years later: Meanwhile there is spring-data-jdbc which looks like it answers the…
yglodt
  • 13,807
  • 14
  • 91
  • 127
2
votes
2 answers

3 digits difference between Java Instant and Postgres TIMESTAMPTZ

Given the following field in Java: private Instant createdDate = Instant.now(); corresponding to the following field in Postgres: created_date TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP; and saved to database using Spring Data JDBC…
Marco Lackovic
  • 6,077
  • 7
  • 55
  • 56
2
votes
3 answers

How to get a map of object properties to table field names in Spring Data JDBC?

I have an annotated entity object with custom table and field names which i use with Spring Data JDBC (not JPA). Smth like: @Data @Table("custom_record_table") public class Record { @Id @Column("id_field") Long id; String name; …
user1032836
  • 55
  • 1
  • 7
2
votes
1 answer

Spring Data JDBC not using join when requesting related tables

I have 2 linked tables in the same aggregate but Spring Data JDBC does not use join for retrieving data. It does several Select requests instead, and I don't see why. The tables: TestA (aggregate root) idA (integer, PK) TestB idB (integer,…
bcassand
  • 41
  • 2
2
votes
3 answers

How to make @CreatedBy and @CreatedDate non modifiable in Spring data jdbc?

I am using simple crud operations with auditing in spring data jdbc. so when ever i insert new record auditing works absolutely fine. but when i am updating my record my createdby and createddate setting to null. is there any way i can avoid…
Ravi
  • 152
  • 1
  • 11
2
votes
1 answer

Spring Repository query by multi-valued property

Trying to solve a problem where I have a class Student. public class Student { @Id UUID id; String name; Long year; List attributes; } And a class Attribute public class Attribute { @Id private UUID id; …
2
votes
1 answer

spring data jdbc. Can't add custom converter for enum

I want to have enum as a field for my entity. My application is look like: Spring boot version plugins { id 'org.springframework.boot' version '2.6.2' apply false repository: @Repository public interface MyEntityRepository extends…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
2
votes
0 answers

Quarkus alternatives to spring-data-jdbc

Default DAO layer / ORM framework in Quarkus is Panache (on top of Hibernate). It's very weird, since i didn't find any built-in integration for pluggable external L2 cache implementations like Redis. Quarkus is called cloud-native but in real…
2
votes
2 answers

Show log message about Rollback process

I am testing some rollback capabilities with Spring Data JDBC, but reviewing the logs from one test execution, I don´t see that log with something like "Rollback for xxx" Log…
jabrena
  • 1,166
  • 3
  • 11
  • 25
2
votes
1 answer

Persist Java Map as PostgreSQL jsonb using spring data jdbc

I am using spring-data-jdbc to persist the following entity into PostgreSQL @Table("abc_configurations") data class AbcConfiguration( val name: String, val distribution: Map ) The distribution is a jsonb column in PostgreSQL…
Anil Bharadia
  • 2,760
  • 6
  • 34
  • 46
2
votes
1 answer

Problem with aggregate root with more than one value object of the same type

I'm new to Spring Data JDBC and create a Customer aggregate with two Address values using Spring-Boot 2.5.0, Java 11 and Lombok (code examples simplified). I have one Customer entity (aggregate root) and one Address value…
2
votes
1 answer

spring-data-jdbc integrate with mybatis

I am currently using myBatis for my project, it is good for complex SQL, but I found that I need to create many redundant SQL for basic CRUD. So I come across spring-data-jdbc (here), which is a very nice library (similar to spring-data-jpa but…
Sam YC
  • 10,725
  • 19
  • 102
  • 158
2
votes
1 answer

Multi-Tenant Spring Data JDBC

There are several multitenancy models around https://vladmihalcea.com/database-multitenancy/ Dedicated DB per tenant Shared DB, but one schema per tenant Shared schema with tenantId discriminator column per table Are there any plans to support…
Mahatma_Fatal_Error
  • 720
  • 1
  • 10
  • 26
2
votes
3 answers

Unterminated dollar quote init script with testcontainers

I have an init script to be executed on testcontainers (postgres) startup. My setup is: spring boot spring data jdbc testcontainers on docker postgresql All framworks are up to date as of today. This is an excerpt of the script: create or replace…
2
votes
1 answer

Same entity for two different aggregate

My schema will be something similar to the above picture. I am planning to use Spring data JDBC and found that If multiple aggregates reference the same entity, that entity can’t be part of those aggregates referencing it since it only can be part…
user1862354
  • 117
  • 11