12,030 questions
-2
votes
2
answers
90
views
@Transactional annotation is not working in Spring Boot for multiple child classes
I am trying to keep multiple db calls in multiple classes under same transaction.
EX: Parent class (service 1)
@Service
@Slf4j
@RequiredArgsConstructor
public class Processor {
private final ...
4
votes
1
answer
10k
views
Spring boot how to use Hikari auto configuration but set username/password at runtime
I am using Spring boot 2.0.1 with Hikari CP and want to use application properties to set Hikari datasource properties like Connection timeout, Maximum pool size etc but the username and password ...
0
votes
1
answer
97
views
MongoDB Timeseries Query Not Using Index And Taking Excessively Long
I have a large timeseries collection filled with millions of documents called "Events" that have the following structure
{
"_id": {"$oid": "123456"},
"...
7
votes
5
answers
17k
views
Spring data: DeleteAll and Insert in same transaction
I am trying to achieve below native query logic using hibernate (Spring JPA). But save(Iterable) throws exception and rollback the entire transaction if one of the record fails to persist. Is there ...
1
vote
1
answer
9k
views
Spring MongoTemplate updateMulti with Limit?
I'm using Spring Data's MongoTemplate to update multiple documents with a single query. I need to be able to limit the number of documents I update per call. For reasons unclear to me the limit isn't ...
12
votes
3
answers
13k
views
Spring Data: when use Projection interfaces and DTO projections?
I have this situation:
Spring Data JPA: Work with Pageable but with a specific set of fields of the entity
It about to work with Spring Data and working with a specific set of fields of an @Entity
...
Advice
0
votes
0
replies
28
views
How to apply multi-tenancy pre-filters to all Spring Data Elasticsearch repository queries (including findById and custom @Query)?
I am trying to implement multi-tenancy in a Spring Boot application using Spring Data Elasticsearch.
My goal is:
Automatically inject a tenantId filter into all Elasticsearch queries
This must apply ...
2
votes
1
answer
126
views
@Nationalized probably not working with Hibernate Envers audit
I am using Spring Boot with Hibernate Envers to manage audit tables in a SQL Server database.
To optimize performance and handle non-Unicode strings properly, I updated my SQL Server connection string ...
4
votes
2
answers
177
views
Adding new DB support in spring data
Currently spring data has multiple db support (mysql, cassandra, mongo.. very big list), however i want to add my custom repository from the scratch like adding custom db support in spring data. I don'...
0
votes
1
answer
214
views
Spring Data JDBC - mapping a series of nested one-to-many relationships inside an aggregate
This is a request for clarification after watching a video about Spring Data JDBC.
I have an aggregate made of Book (aggregate root), BookCopy and BookCopyQualityControl. A Book has many BookCopy, and ...
1
vote
2
answers
8k
views
Find Distinct results in spring data jpa
Im trying to fetch Distinct records, SQL query looks as follows
select DISTINCT id from Table A where UserId = 'XXXX';
Currently, I have implemented this using spring data jpa @Query
@Query(value = &...
5
votes
2
answers
9k
views
Dealing with empty or null collection parameter in JPA
Inside org.springframework.data.jpa.repository.@Query annotation I check if field in a collection and possibly ignore collection if it is empty:
@Query(""select e from #{#entityName} where e.type in :...
3
votes
1
answer
1k
views
Do I really need countQuery in a native @Query for pagination?
According to the reference, countQuery is required for native queries pagination (at least there is an example with it). But according to my tests (Spring Boot 2.4.5), @Query pagination works without ...
18
votes
1
answer
6k
views
How to declare a repository populator bean using java config instead of XML?
I am working on a Spring based project that is (so-far) completely XML-free, except now I've hit a wall with the Spring JPA repository populator:
<repository:jackson-populator location="classpath:...
0
votes
0
answers
23
views
How can I create a "managed type" for a Spring Data 3.4 @NativeQuery interface to access data with?
We have a very sparse DAG stored in a MySQL 8 table. I want to get all of the nodes leading into (and out of) a given node. The query can be written without too much trouble with the help of this ...