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

JdbcSQLSyntaxErrorException column not found while using Spring data JDBC

I was reading the Spring data JDBC docs and doing experiments. While doing that I was trying to make simple one to many relationships using @MappedCollection annotation in then parent class and getting the error saying column not found. However I…
Sudhir Kumar
  • 163
  • 2
  • 15
3
votes
1 answer

Spring Data JDBC customized Query with order Parmeter not working

I try to order my custom query with a custom parameter like so: @Query("select * from person where firstname = :name" + " order by :order") List findByFirstNameCustomQuery2(@Param("name") String name, Pageable page, @Param("order") String…
3
votes
2 answers

Spring data JDBC query creation with pagination complains IncorrectResultSizeDataAccessException: Incorrect result size

I'm struggling to trying the pagination feature, as described in the reference document. This is my table schema: CREATE TABLE cities ( id int PRIMARY KEY, name varchar(255), pref_id int ); Repository: public interface…
Ozawa Tomohiko
  • 157
  • 1
  • 1
  • 7
3
votes
3 answers

spring-data-jdbc support for Oracle

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…
3
votes
2 answers

Springboot: Issue when importing spring-data-jdbc and spring-data-cassandra together within same project

In my springboot application I want to connect to two datasources, a cassandra DB and an oracle DB. So, I have added the below to my pom.xml: org.springframework.boot
3
votes
1 answer

Spring Data JDBC Generating Bad HSQLDB Query with Boot 2.3.0

I have a Spring Boot project that uses Spring Data JDBC. The tests use HSQLDB. My repository tests started failing when I attempted an upgrade to Spring Boot 2.3.0. Spring Data JDBC appears to now quote table and column names. The version of Spring…
mrgrew
  • 211
  • 2
  • 8
3
votes
3 answers

Parametrised order in spring-data-jdbc

I'm struggling with making order parametrised. The best would be to have ... order by :orderColumn :orderDirection ... Is it even possible to turn: @Query("select * from Document where folderId = :folderId AND documentType = :documentType" …
ppysz
  • 380
  • 5
  • 21
3
votes
3 answers

NoSuchBeanDefinitionException after update to spring boot 2.2.1

I face a strange issue after upgrading my existing code from spring boot 2.2.0 to 2.2.1. It seems that my spring data jdbc repositories are not getting scanned anymore somehow: Caused by:…
Thomas Lang
  • 1,285
  • 17
  • 35
3
votes
1 answer

Map single column mapping in spring data jdbc

I'm trying to map a Resource class which has a Map field using Data JDBC. Here is simplified entity: public class Resource { @Id private Long id; private Map props; } I don't want a separate table for props, just a…
Bahadır Yağan
  • 5,577
  • 3
  • 35
  • 39
3
votes
1 answer

Spring Boot and Spring Data Moore Release

I´m facing some strange version issues concerning Spring Boot with Spring Data (JDBC). Excerpt from my pom: org.springframework.boot spring-boot-starter-parent
Thomas Lang
  • 1,285
  • 17
  • 35
3
votes
1 answer

How to customize the column names of the embedded object?

I am trying to use the Spring Data JDBC and I cannot understand if there is a possibility to customize the column names of the embedded object (in JPA we use @AttributeOverrides for this). In my model I created a class Amount they I would like to…
youngDev
  • 329
  • 3
  • 16
3
votes
1 answer

How to implement batch insert using spring-data-jdbc

is it possible to implement batch insert using spring-data-jdbc somehow? Or can i get access to JDBCTemplate using this spring-data realization?
AlbusLupus
  • 81
  • 7
3
votes
1 answer

Optimistic Locking in Spring Data JDBC

I noticed that Spring Data JDBC doesn't seem to implemented Optimistic Locking (something like a JPA's @Version annotation). I was thinking on creating a @Modifying query which considers the version field and returns boolean to check manually if the…
3
votes
2 answers

How to model One-To-One relationship with Spring Data JDBC?

I want to model One-To-One relationship using Spring Data JDBC and PostgreSQL but I'm having trouble setting up root aggregates the right way. There's following scenario: Picture, SQL Each engine is unique, car has unique column engine_id which is…
lolo92
  • 63
  • 1
  • 2
  • 8
3
votes
2 answers

Mapping Java Enum in Postgresql with Spring Data JDBC

I want to be able to map a enum declared in java to an enum created in postgres. For example having the following: CREATE TYPE EYE_COLOR AS ENUM ('BROWN', 'BLUE', 'GREEN'); CREATE TABLE PERSON ( ID INT PRIMARY KEY AUTO_INCREMENT, NAME …
Razvan S
  • 53
  • 1
  • 5