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
1
vote
1 answer

Mapping of Set requires Id?

i have a mapping problem with spring data jdbc as following: Student entity: @Value(staticConstructor = "of") public class Student { private final @Id @Wither long studentId; @NotNull @Size(min = 4, max = 20) private String…
Thomas Lang
  • 1,285
  • 17
  • 35
1
vote
2 answers

Spring data JDBC cannot create repository Bean - "entity is marked @NonNull but is null"

I am just beginning to explore spring data JDBC. I have a simple db (postgres) with a questionnaires table that I am trying to query: CREATE TABLE IF NOT EXISTS foster.questionnaires ( questionnaire_id SERIAL PRIMARY KEY, version…
Funsaized
  • 1,972
  • 4
  • 21
  • 41
1
vote
1 answer

Support for mapping of byte[]

Our entity contains the field byte[] fileContent. Does not seem like spring-data-jdbc is saving it in DB; actually only 1 byte is persisted, and not the whole array. Is there a way to persist binary content using Spring Data JDBC? Thanks
innotech
  • 37
  • 3
1
vote
1 answer

How to select referenced entities with Spring Data JDBC

How to select referenced entities in One-To-May relationship with Spring Data JDBC? When I tried following code on this blog class PurchaseOrder { @Id private Long id; private String shippingAddress; private Set
Ryo Shindo
  • 11
  • 1
  • 4
1
vote
3 answers

Spring Data JDBC - One to Many - Kotlin

I use spring boot 2.1.1.RELEASE and spring-data-jdbc 1.0.3.RELEASE, Kotlin 1.3.10. I have the following simple class definitions in kotlin: @Table(value = "CUSTOMER") data class Customer( @Id var id: Long?, @Column("NAME") var name:…
ielkhalloufi
  • 652
  • 1
  • 10
  • 27
1
vote
1 answer

DataRetrievalFailureException thrown when persisting entity with a non auto-increment id on Oracle database

I use Spring Data JDBC with an Oracle database and I set a custom id on my entity with a BeforeSaveEvent processor. @Bean public DataFieldMaxValueIncrementer incrementer() { OracleSequenceMaxValueIncrementer incrementer = new…
1
vote
2 answers

@Query not working Spring Data JDBC 1.0.0.M3

In my Spring Boot Project, I get the following error when I add an @Query method in my CrudRepository java.lang.IllegalStateException: You have defined query method in the repository but you don't have any query lookup strategy defined. The…
Vedha
  • 13
  • 4
1
vote
0 answers

spring-data-jdbc boolean column mapping to char

I'm trying to persist a Boolean column with [spring-data-jdbc] but conversion defaults to 'TRUE', 'FALSE' values, but database columns is char(1) ('T'/'F'): 2018-07-13 14:58:32.761 [main] DEBUG…
1
vote
1 answer

spring-data-jdbc dependency won't work on pom.xml

I'm following this guide spring-data-jdbc-ext and i'm trying to set this dependency on my pom.xml org.springframework.data spring-data-jdbc 1.0.0.M2
Yaje
  • 2,753
  • 18
  • 32
1
vote
1 answer

How to configure multiple datasources in Spring Data JDBC?

I'm trying to replace some projects to use Spring Data JDBC instead of using JdbcTemplate. Now, I'd like to use it for multiple DataSources, how can I configure it in Spring Data JDBC?
tkmknr
  • 31
  • 2
0
votes
0 answers

springnative running the nativeBuild it throws "java.lang.ClassNotFoundException: com.mysql.cj.PerConnectionLRUFactory"

os:centos7 springboot:3.1.1 application.yml: spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url:…
0
votes
1 answer

How to configure JNDI Datasource with embedded Tomcat for Spring Data JDBC using Spring Boot 3.1.1 that will also deploy to external Tomcat?

So I was curious if anyone has a pattern out there to solve this with a recent version of Spring Boot? My IT Department hosts their own Tomcat servers and prior to me switching over to Spring Boot we would create our own DataSource configuration…
user2976594
0
votes
1 answer

UUID id is null after saving entity with spring-data-jdbc on sql server

I have following table (snippet): create table users ( user_id uniqueidentifier default newid() not null primary key, name varchar(192), ... ) and the entity: import org.springframework.data.annotation.Id; import…
lunatikz
  • 716
  • 1
  • 11
  • 27
0
votes
0 answers

I have a List of Enums that needs to be Passed to a database, I'm using Spring Data JDBC, How to do that?

I have a Movie class which has this fields : @Table(value = "MOVIES") public record Movie( @Id long id, @NotBlank String title, String director, @NotNull @Column("MYEAR") Long…
0
votes
0 answers

Handle relationships while querying the data from a MySQL database using java

Problem Statement: I am trying to export a huge database using java. I have implemented it using queryForStream() of JDBCTemplate as it provides streaming feature. For normal entities, its working perfectly. For, let's say ~3GB of data, its…
Emperor
  • 11
  • 4