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

Is there a way to select all columns for a SELECT statement with JOINs without breaking the entity mapping?

I have a application_user table with a corresponding UserEntity record. Additionally, I have a user_meta_data table with a UserMetaDataEntity record as a 1:1 relation to the user. @Table("application_user") record UserEntity(@Id @Nullable Long id, …
Elektropepi
  • 1,115
  • 1
  • 13
  • 22
0
votes
1 answer

Spring-data-JDBC Save (Update) doesn't update

I have a Spring application where the Domain Object identifier is not assigned by the database, but it generated by the application. The identifier is generated and added to the Domain Object during the BeforeSave callback. After saving the domain…
DashingSuprHero
  • 177
  • 1
  • 2
  • 11
0
votes
1 answer

AnsiDialect not available in spring-data-jpa tree

I'm interested to use an AnsiDialect from spring-data-jdbc to connect to my Oracle database using a proprietary driver. However, this dialect is not present in spring-data-jpa (only contains dialects from hibernate) Is there a way to do this, or do…
user6761124
  • 117
  • 12
0
votes
1 answer

Field specific converter in Spring Data JDBC

I want to write a custom converter in Spring Data JDBC like this - @ReadingConverter public class IntegerToStringConverter implements Converter { @Override public String convert(Integer source) { return source !=…
0
votes
1 answer

Spring Boot Data JDBC: Mapping 1 to 1 relationship and persisting in kotlin

Hello together I am currently trying to persist an entity to the database with a 1 to 1 relationship. I am using spring version 2.5.3 (spring-boot-data-jdbc). When I try to persist via rest post and the usual crud repository save() method with this…
tony_devvy
  • 11
  • 2
0
votes
1 answer

Why I'm getting duplicate entry exception, when trying to save not new aggregate entity?

I have two tables, these are profile_info and user_Info. Database ER-diagram Table creation: CREATE TABLE `user_info` ( `id` int NOT NULL AUTO_INCREMENT, `userLogin` varchar(20) DEFAULT NULL, `userPassword` varchar(60) DEFAULT NULL, …
0
votes
1 answer

How to use AbstractAggregateRoot or the annotation DomainEvents with Java Records

I am trying to evolve a domain which it includes and Aggregate-root implemented with Java Records and I am not able to find a way to use the Domain Event concept to propagate events from one…
jabrena
  • 1,166
  • 3
  • 11
  • 25
0
votes
1 answer

How to make related entity's id(auto-incremented) to be inserted when using one to one relationship in spring-data-jdbc?

I have two tables, these are profile_info and user_Info. Database ER-diagram Table creation: CREATE TABLE `user_info` ( `id` int NOT NULL AUTO_INCREMENT, `userLogin` varchar(20) DEFAULT NULL, `userPassword` varchar(60) DEFAULT NULL, …
DozezQuest
  • 179
  • 7
0
votes
1 answer

How can i map entity column to json Key in Spring Data JDBC

this is my entity @Table("amazon_rds_inventory") public class AmazonDBInstanceDataSelect { @Id @Column("id") private long id; @Column("inventory_metadata") private String inventoryMetadata; @Column("aws_identifier") …
Aman Kashyap
  • 25
  • 1
  • 7
0
votes
1 answer

Problem with an entity using just a list of values in Spring Data JDBC

I'm using Spring-Boot 2.5.0, Java 11, a Postgres DB and Lombok. I have e.g. a list of articles as an entity: @Data @Builder @AllArgsConstructor public class Articles { @Id private Long id; @Builder.Default private List
Stefan
  • 67
  • 6
0
votes
2 answers

In Spring Data JDBC bypass @CreatedDate and @LastModifiedDate

I am using Spring Data JDBC. I have an entity that has fields annotated with @CreatedDate and @LastModifiedDate. However, in some cases I want to set these two fields manually. Is there a way to bypass @CreatedDate and @LastModifiedDate in some…
Harold L. Brown
  • 8,423
  • 11
  • 57
  • 109
0
votes
1 answer

After Upgrading spring-data-jdbbc from 1.1.12.RELEASE to 2.0.6.RELEASE LocalDateTime parameters in Repository methods fail

I am trying to upgrade from Spring Boot 2.2.x to 2.3 I have encountered an issue with the upgrade of spring-data-jdbc. In 1.1.x one could write the following query and it would work as expected @Modifying @Query("UPDATE monitoring SET…
gmich
  • 329
  • 2
  • 19
0
votes
1 answer

Spring Data JDBC - Autowire Repository object dynamically

I am using spring data JDBC. I normally use the specific repository object as auto-wired and perform the necessary operation. Let us consider, I have employees who belong to a specific continent. We have a repository for each continent. After…
user1862354
  • 117
  • 11
0
votes
0 answers

How do longitude and latitude map to x and y parameters of spring data Point correctly?

I have longitude and latitude coordinates saved in a database and would like to map it to a MySQL POINT column in another MySQL table. I'd like to use spring data Point in my code with the constructor Point(double x, double y). Unfortunately, I…
Ira Re
  • 730
  • 3
  • 9
  • 25
0
votes
0 answers

Insert cube into postgres database using spring-boot

I had a repository like so: @Repository interface Repository { @Query("insert into t values (cube(:array))") void save(float[] array) } which gives there error Unable to find server array type for provided name REAL. I even tried to…
Tobi Akinyemi
  • 804
  • 1
  • 8
  • 24