How to select query filter in one-to-one relationship with Spring Data JDBC ?
Schema looks like this, basically 2 tables where Rental references Movie
drop table if exists rental;
drop table if exists movie;
create table movie
(
id …
I am working on a new project using spring data jdbc because it is very easy to handle and indeed splendid.
In my scenario i have three (maybe more in the future) types of projects. So my domain model could be easily modelled with plain old java…
I tried to write a query method in my repository similar to this
@Modifying
@Query("UPDATE foo SET some_timestamp = :someTimestamp WHERE id = :id")
void updateSomeTimestamp(@Param("id") long id, @Param("someTimestamp") Instant someTimestamp)
When…
I have tried to figure out which version of spring-data-jdbc to use with Spring Boot 1.5.20.RELEASE (= Spring Framework 4.3.23.RELEASE) - but I can't find that info anywhere.
Is it because spring-data-jdbc only work with Spring Boot 2.x / Spring…
My Data model is
@Getter
@Setter
public class Customer {
@Id private ID id;
@CreatedDate protected Instant createdAt;
@LastModifiedDate protected Instant updatedAt;
@CreatedBy protected String createdBy;
@LastModifiedBy protected…
I am trying to use Spring Data JDBC for my PostgreSQL database. I defined the following beans
@Data
class Report {
@Id
private Long id;
private String name;
private Set dimensions;
}
@Data
class Dimension {
…
Is there a good way of how to handle soft-delete in Spring Data JDBC?
In Spring Data JPA we can either add @Where(clause="is_active=1") annotation or extend CrudRepository or PagingAndSortingRepository.
Since Spring Data JDBC doesn't support SPEL in…
I wanted to create a nested datastructure.
Entity1 contains Objects of type Entity2 stored in a Map. Entity2 should contain a Map of Objects of Entity3.
The first part, Entity1 and Entity works fine. When I add Entity3, an Exception occurs.
When I…
In Spring Data JDBC examples, how do I write a simple query in @Query annotation?
e.g. In LegoSet Repository, how do I add a simple findByName query?
When I tried
@Query("select * from lego_set where name = :name")
List…
I am trying to use @CreatedDate in combination with spring-data-jdbc and a PostgreSQL database to track when a table entry was first created. This works when a new row is inserted (it correctly sets it as the current date), but when updating the…
If you want to see what SQL statements Spring Data JDBC is executing, how would you do that?
Since it uses bind variables, I also want to see their values in the logs.
In my view I send async request to controller with Json Data as following:
{
"filters":{
"someField":"someValue",
"someField":"someValue",
"someField":null,
"someField":null,
}
}
But data can be different.
And I have…
With spring boot + spring data jdbc i have to wire the DataSource bean by myself. Like so:
@Bean
public DataSource dataSource() {
HikariConfig hikariConfig = new HikariConfig();
…
It seems to me that when we run repository.save(entity) and the entity has a LocaldateTime variable mapped to a column of type timestamp(6), spring-data-jdbc (or some underlying library) is rounding off the data inserted in the column to 3 decimal…
AFAIK, the Pageable class supports only LIMIT/OFFSET based paging. However, while being a quite universal solution, it comes with some downsides as outlined here https://momjian.us/main/blogs/pgblog/2020.html#August_10_2020
Keyset Pagination (aka…