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

Customconversions not working in spring data jdbc

Before going to actual issue let me brief what i am looking for. I am looking for encrypt and decrypt the fields inside entity. in JPA, we can use Attribute converter and achieve this. but in spring data jdbc its not supported it seems. So, i am…
Ravi
  • 152
  • 1
  • 11
0
votes
1 answer

Spring Data Rollback only rolls back partially

While integration testing, I am attempting to test the execution of a stored procedure. To do so, I need to perform the following steps: Insert some setup data Execute the stored procedure Find the data in the downstream repo that is written to by…
0
votes
2 answers

Spring Data JDBC + Querydsl: error "JdbcRepositoryFactory does not support Querydsl"

I want to use Spring Data JDBC with QueryDSL support. According to Spring documentation (https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/#core.extensions.querydsl) it is supported, but I couldn't make it working. I use MariaDB as…
0
votes
1 answer

Spring Data JDBC many to many relationship management

I have a many-to-many relationship person -> person_address <- address and use a reference class. But in my Person aggregate root it seems only adding person_address works (addresses collection): @MappedCollection(idColumn = "PERSON_ID") private…
0
votes
1 answer

How to map to an entity which is not directly related

I am using spring-data-jdbc and I have following tables - table course_details {course_id, course_name} Example - {1, 'Primary Education'}, {2, 'Secondary Education'} table course_year {year_id, year_name, course_id} Example - {1, 'Year 1', 1}, {2,…
0
votes
1 answer

spring-data-jdbc: JdbcQueryCreator: Cannot query by nested entity

I'm in the process of creating a service using Spring Boot (first time using Spring). I have an entity that is identified by a triple (mission, cycle, id) in the database, this is logically the primary key. To work around the requirement of…
asm
  • 8,758
  • 3
  • 27
  • 48
0
votes
2 answers

Why does HSQLDB and Spring Data JDBC claim my table does not exist?

I posted something similar of the same issue a few days ago but now I think I (with the help of some of the people who commented on the post) narrowed it down to know what I need help with exactly. I am trying to use the Spring Data JDBC in my…
0
votes
0 answers

Spring can't find repository bean

I'm using spring boot with spring data jdbc and I got trouble with run my app I have StudentService class: package ru.turnip.service; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import…
0
votes
1 answer

Spring Data JDBC column alias in derived query getting truncated

I am using Spring Data JDBC 2.0.5 (as pulled in by Spring Boot 2.3.5) on top of Postgres 11.10. In our domain model we have an aggregate root that looks something like the following: @Table(...) class OurAggregateRoot { @MappedColumn(...) //…
Will
  • 3
  • 1
0
votes
0 answers

Can't map List to database UUID[] Couldn't determine JDBCType for class java.util.UUID

I have following table definition: CREATE TABLE my_table ( id UUID NOT NULL DEFAULT uuid_generate_v4() PRIMARY KEY, result UUID [] ); Entity definition: @Table("my_table ") public class MyTable { @Id private UUID id; …
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
2 answers

How to implement count sql query by my multiple columns and one of them is constant?

I have following method and it is working. But It doesn't work if I remove @Query annotation. import org.springframework.data.jdbc.repository.query.Query; ... @Repository public interface MyRepository extends PagingAndSortingRepository
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
1 answer

How would I implement Spring Data JDBC Many to Many between 2 tables if I have a third table that contains a foreign key to my bridge table?

I learned that in Spring Data JDBC I need to implement many to many relationships by having a reference to the ID of one entity in the other entity: public class Student { @Id private Long studentId; private String studentName; …
0
votes
1 answer

Spring data jdbc and querydsl calls in one transaction do not work

I'm using spring-boot-starter-data-jdbc and infobip-spring-data-jdbc-querydsl-boot-starter(5.4.2) together. In my tests with org.springframework.transaction.annotation.Transactional annotation I have the following code: @Transactional void test() { …
user3435425
  • 192
  • 1
  • 18
0
votes
1 answer

Spring JDBC returning null values for columns with values

I am having a very weird experience with spring-boot-starter-data-jdbc:2.6.2. Two similar queries returning different results. When I use @Query in the repository as shown below, I get back a few columns but the rest returned as…
Geek Guy
  • 710
  • 1
  • 8
  • 28
0
votes
2 answers

Spring data jdbc mapping not working if use not primary key

I have 2 entities: @Data @Table("main_entities") public class MainEntity { @Id private Long id; private String anotherId; @MappedCollection(idColumn = "main_entity_id") private SecondEntity…