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

spring-data-jdbc error Required identifier property not found for class

Getting below error while loading data from database java.lang.IllegalStateException: Required identifier property not found for class com.sudhirt.practice.springdatajdbcpractice.entity.AuthorRef! at…
Sudhir
  • 1,339
  • 2
  • 15
  • 36
1
vote
1 answer

Does spring-data-jdbc consider providing annotations like JPA ID generators?

Does spring-data-jdbc consider providing annotations like JPA ID generators? The current way of using events needs to be defined too much, or you need to inherit the base class to implement. Or the current version already provides similar features,…
Hyman Yang
  • 33
  • 6
1
vote
1 answer

Auditing with spring-data-jdbc?

I have seen the response in the previous question! , but it did not solve my problem. I traced the code of spring-data-jdbc and found that as long as the BeforeSaveEvent event is customized and a custom ID is set in this event, after the custom…
1
vote
3 answers

Is it a must to use spring-data-jdbc when using JdbcTemplate?

I am planning to use Spring JdbcTemplate to access my database. Is it a must to use spring-data-jdbc when using JdbcTemplate? The reason I am asking is I don't need "entity"(POJO) for my table in my application. Would it add some overheads if I use…
GnahzNiX
  • 83
  • 1
  • 5
1
vote
1 answer

Spring Data JDBC - immutable owner of OneToMany relation

I'm trying out Spring Data JDBC, and I think that immutable entities are the key feature here. I want to model a one-to-many relationship between Team and Player and have these entities immutable. What I have working right now…
Jan Siekierski
  • 409
  • 6
  • 14
1
vote
1 answer

Update referenced aggregates using SQL Server fails with ´Cannot insert ... when IDENTITY_INSERT is set to OFF´

We are using latest Spring Data JDBC milestone (1.1.0.M3) together with SQL Server. Updating referenced aggregates (not the aggregate root itself) - fails with: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert explicit value for…
innotech
  • 37
  • 3
1
vote
1 answer

Null-values for embedded objects are not accepted

I am trying to persist an object containing an embedded one using Spring Data JDBC. And it is not saved because it does not pass a null-check. I created an outer class to persist. data class Outer( @Id val id: Long, val value:…
youngDev
  • 329
  • 3
  • 16
1
vote
1 answer

How and Where was the my repository interface instanced by SimpleJdbcRespository?

I created a custom repository interface that extended by CrudRepository. I just used @EnableJdbcRepositories in StartApplication. When I test a method from my custom repository, such as save(T t) I seen it be instanced by…
1
vote
1 answer

Stream very large table via spring-data-jdbc Resultset.TYPE_FORWARD_ONLY READ_ONLY

Hi I would like to stream a very large table spring-data-jdbc. For this purpose I have set my connection to READ_ONLY I have declared in my repository a method that looks in the following way: PackageRepository extends Repository
Alexander Petrov
  • 9,204
  • 31
  • 70
1
vote
2 answers

Problems replacing Spring-data-jdbc 1.0.5 with spring-data-jdbc 1.1.0

The last version of spring-boot-starter-jdbc contains spring-data-jdbc 1.0.5 version. I am trying to update the version of the spring-data-jdbc. But the console shows me a problem. Caused by:…
1
vote
1 answer

Is there equivalent of @BatchSize in spring-data-jdbc

Hi I used spring data to map my Entity and Repository. The mapping is very simple: public class Car { Set parts; } public class Part { } I use the findAllByIds(Iterable) interface of my spring data repository. And it generates a nice…
Alexander Petrov
  • 9,204
  • 31
  • 70
1
vote
1 answer

@Version column is not working out of the box with spring data jdbc

I have my version column defined like this @org.springframework.data.annotation.Version protected long version; With Spring Data JDBC it's always trying to INSERT. Updates are not happening. When I debug I see that, PersistentEntityIsNewStrategy is…
Seetha
  • 980
  • 1
  • 8
  • 27
1
vote
1 answer

DataRetrievalFailureException when saving aggregate root using Azure SQL Server

Problem Description - Saving aggregate roots without embedded entities works fine The issue arises when saving an aggregate root which aggregates another entity (one-to-one containment relationship) Spring Data JDBC seems to behave correctly as I…
1
vote
1 answer

Load queries from property file JDBC Java

So, the case is the following. I have a piece of code that looks like this: public interface CustomRepo extends CrudRepository { @Query(value = "select * from custom") public List findAll(); } Together…
1
vote
1 answer

How to model immutable entities with static factory method

Hello there i have a question concerning the right way of modelling immutable entities: Consider this entity (edited as of the suggestion by Jens Schauder): @Getter @RequiredArgsConstructor(staticName = "of", access = AccessLevel.PACKAGE) public…