DB Schema (H2 database):
create table book (
id_book bigint auto_increment not null primary key,
title varchar(255) not null,
id_author bigint not null,
id_genre bigint not null
);
create table comment (
id_comment bigint…
I'm trying to build a small REST API with Spring Boot that has connectivity to Database using Spring Data JDBC (with Hikari CP).
The app should run on container environment like k8s.
At moment I'm facing a problem, when the app does not have db…
I am attempting to call an Oracle stored function via Spring Data JDBC (NOT JPA but JDBC) with the @Query annotation:
@Repository
public interface UserRepository extends CrudRepository{
@Query(value="? = call…
If a transaction is started using Spring's @Transactional, is there any issue using a combination of JPA and JDBC within this transaction?
Meaning, will the transactional handling still work as expected where if an rollback happens, it will rollback…
I've put a derived query on a CrudRepository that should delete all entities with a given businessId (which is not the primary key but just another, non-unique column), of which there can be many.
In my SpringDataJdbcTest test, I…
I am currently playing around with the Spring Data Jdbc framework and I don't understand the following behaviour:
When I have an aggregate root that stores a list of children and I add one child, it deletes all children and inserts them again.
This…
long countActionByStateIn(ActionState[] states); // works
// throws Couldn't determine JDBCType for class com.example.ActionEnum
@Query("Select * from action WHERE (COALESCE(:states, NULL) IS NULL OR state IN (:states))")
public List…
for my latest assignment I'm developing a Spring boot application which will connect with an Oracle 21c database.
The feature of the oracle release we're interested in is the native JSON data type called OSON (reference here: Oracle 21c JSON data…
In spring-data-jdbc 2.3.2 with 2.6.4 data-jdbc starter. I am seeing the following output. Not clear if this is my error in a model layer or an issue with the framework.
This happens when the root aggregate tries to get updated because of a…
Edited:
I also tested in the version 2.6.4 and still happens
I just upgraded spring-boot from 2.5.7 to 2.6.1 and I notice a change of behavior in a specific query. I'm trying to load only a specific column in a query, and when it's value in DB is…
I have a model which i want to save to database.
@Data
public class Model {
@Id
private UUID id;
private String name;
private ModelSettings settings;
@Data
static class ModelSettings {
boolean fuelEngine;
…
How can I model many to many relationship with same entity with spring data jdbc. I have a scenario where a task can depend on several other task and at the same time the task has dependants but it is same object. I have done this previously with…
Is it possible to cascade creation in Spring Data Jdbc as in Spring Data JPA for OneToMany and ManyToMany relationships? If not, what would be the strategy then ?
@Table("orders")
public class Order {
@Id private UUID id;
…
I have a database with multiple schemas (one schema per customer), with each schema having the same tables. This is a common pattern in multitenant apps.
I'm trying to use Spring Data JDBC to access these tables. I see how you can specify a…
Summary: Spring Data emits warnings as it SELECTs the the same column twice. The warning is:
(...) WARN o.s.d.j.core.convert.ResultSetAccessor : ResultSet contains id multiple times
This is spring-boot-starter-data-jdbc via Spring Boot 2.5.5…