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

How to fetch complex return value from (Oracle) stored function with Spring Data (JDBC)

I'm trying to access a stored function from an oracle database package and fetch the complex return type. Here are the required code snippets function get_service_params_by_mac (p_mac_address in varchar2) return…
0
votes
1 answer

Using H2 for unit test and postgres for prod with Spring Data JDBC

With Spring Data JPA, I could use H2 for unit tests and postgres(or any other relational DB) for prod. Here, I need not worry about compatibility issues with queries as its abstracted by JPA. Can I use the same combination of DBs with Spring Data…
Omkar Shetkar
  • 3,488
  • 5
  • 35
  • 50
0
votes
1 answer

Multitenancy with spring data jdbc

I followed that tutorial to implement multitenancy on my spring application and everything works fine. When I tried to replace pure jdbcTemplate with spring-data-jdbc to use crudRepositories i have this error: java.lang.IllegalStateException: Cannot…
Luca Farsetti
  • 257
  • 2
  • 14
0
votes
1 answer

Can Spring Data JDBC use object properties as query parameters?

Currently I use the following code for a custom SQL statement in a Spring Data JDBC Repository interface: default void upsert(LoanRecord r) { upsert(r.getId(), r.getUcdpDocumentFileId(), r.getFreSellerNo(), …
Bogdan Calmac
  • 7,993
  • 6
  • 51
  • 64
0
votes
0 answers

How much does Transactional slow the code?

In my application accessing the database is slow compared to other code, as it has to go over the network. By my understanding, when wrapping a single database statement in @Transactional in Spring, it does 3 calls to the database. First it sets…
0
votes
2 answers

Lifecycle event not working for non aggregate entity Spring Data JDBC

I am using two entities, Employee and Address, where Employee has the controller to do CRUD operations. So for both the entities I am using lifecycle events where Employee events are working fine but not the Address events. So I am trying to save…
Ravi
  • 152
  • 1
  • 11
0
votes
1 answer

Spring data JDBC custom query

I have defined the following custom database query. @Query("select po.* from purchase_order po where po.purchase_order_number = :purchaseOrderNumber") List findByPurchaseOrderNumber(String purchaseOrderNumber); This query always…
Hossein
  • 107
  • 1
  • 10
0
votes
0 answers

Spring Data JDBC and effective work with many-to-one refs

Its quite easy to use spring data jdbc dealing with CUD actions for entities with many-to-one refs, but the R(eading) is not so straightforward. Although i could use AggregateReference for querying data with ids only, but frontend asks for full data…
user1032836
  • 55
  • 1
  • 7
0
votes
0 answers

JdbcRepositoryFactory does not support Querydsl

Is the support for Querydsl remove in Spring Data Jdbc 3.0.0-M6? I am now getting an error ‘JdbcRepositoryFactory does not support Quersdsl’ after i upgraded from Spring Boot 3.0.0-M4 to 3.0.0-M5.
0
votes
1 answer

spring data jdbc - @query with like

In Spring Data JDBC, How I can write in CrudRepository a query with "like", I have try with this one, but it throws an error @Query("select * from people p where name like :startOfName%") org.springframework.jdbc.UncategorizedSQLException:…
javi_alt
  • 21
  • 3
0
votes
1 answer

Spring Data JDBC aggregate ID in child objects

I was playing with Spring-Data-JDBC and encountered 2 issues. I have following entities with 1:N relationship. ------ DROP TABLE IF EXISTS product; CREATE TABLE product ( product_id int AUTO_INCREMENT PRIMARY KEY, name varchar(250) not…
Rana_S
  • 1,520
  • 2
  • 23
  • 39
0
votes
1 answer

Spring Data JDBC MappedCollection casing issues with Postgres + Oracle

This is my current repo structure, I'm looking for a solution that works with both Postgres and OracleDB and preferably does not involve changing my DB schema to accomodate the ORM. Whether Postgres or Oracle is used is in defined in the…
mase
  • 1
0
votes
1 answer

UnsatisfiedDependencyException when referencing Repository from another module

I have a Kotlin Spring Boot application (com.myapp.webapp.Application) which uses a Repository bean defined in an external library (com.myapp.engine.MyRepository). Such repository is not a JpaRepository because I want to avoid JPA in this stage of…
0
votes
1 answer

Is it plausible to uswe spring-data-jdbc in a scenario where the DB-schema differs from the domain-model

I'm considering using spring-data-jdbc for a project. But i don't have any control over the DB-schema. My domain model can be populated by the existing tables, but they differ in many ways. Examples: A specific aggregate in my model consists of…
0
votes
1 answer

How can you write a query that checks the value of a JSON column?

Suppose I have a table with three columns: id, name, state. The state column is of type jsonb and the structure would always have (as a minimum) a key called active e.g. {"name": "some_name", active: true, ...} {"name": "one_two", active: false,…
vab2048
  • 1,065
  • 8
  • 21