While using spring-data-jdbc and postgresql to store and search data, I was not able to come up with a query inside @Query annotation which can cover collections which are nulls.
I mean the following simplified example:
@Query("SELECT * FROM…
I have a custom search page, where i can enter up to 6 search options. This options are combined with AND so by using all filters i have 6 where clauses and so on.
Two questions:
Is there a way to code this dynamic where query with spring data…
Given an entity definition like the following:
public class FooBar{
@Id
private long id;
private Long fooNumber;
private Long barNumber;
...
//Other inconsequential properties
}
I would like to run the following…
Is there any way to change the default column naming strategy for a referenced entity then the default (name of the class). The docs say to call the method setForeignKeyNaming(ForeignKeyNaming.IGNORE_RENAMING) on RelationalMappingContext's…
I'm writing a custom query with Spring Data JDBC:
public interface AuditRecordRepository extends CrudRepository {
@Modifying
@Query("DELETE FROM audit_records ar WHERE ar.created_on <= :date;")
int retainDataBefore(@Param("date")…
here is the situation:
I need to be able to filter/sort on server side, preferably directly on DB query, not to fetch all and filter/sort on app level.
Then, due to:
no option to switch to JPA, we stick to JDBC
pagination and sorting is…
Given the following three tables describing an item that can be either a toy, a food or unknown:
CREATE TABLE item (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
type VARCHAR(255) NOT NULL CHECK (type IN ('TOY', 'FOOD',…
I'm experiencing connection leaks with my spring data jdbc postgres app. Basically for my calls that are not called in a transaction the connection is acquired and released to the pool. However when it comes to transactional calls connections are…
I would like to know how to best use Spring Data to query the same set of database tables differently depending on the use cases.
Scenario: Products can be bought by Users via Orders. Each Product can either be a standalone product or consist of…
I have a spring boot application that uses spring data jdbc and connects to two databases. One of them is postgres and one is oracle. I access them via jdbc repositories (org.springframework.data.repository.Repository).
That works very well in…
This reference documentation from spring.io states claims that Spring Data JDBC supports a @Lock annotation.
Spring Data JDBC supports locking on derived query methods. To enable locking on a given derived query method inside a repository, you…
How to change order of callbacks in spring data jdbc? Primary, order, dependsOn used, didn't help.
@Bean
AfterDeleteCallback extends Document> test() {
return (document) -> {
log.info("test");
return document;
…
This is a follow-up question to this: Reference to another aggregate vs. sub-entity
I have the following Aggregate:
Evaluation (root)
|
|__Employee (entity)
| |_SupervisorId (value object)
|
|__Year (value object)
|
|__ExpiryDate (value object)
I…
Let's assume we have three aggregates:
Employee
Evaluation
Contract
Both Evaluation and Contract are referencing Employee (using an AggregateReference or the ID itself).
The problem is that both Evaluation and Contract very regularly need specific…