Category "spring-data-jpa"

Spring Data JPA - Derived Count Query without filtering

I am trying the methods I've found at: https://www.logicbig.com/tutorials/spring-framework/spring-data/derived-count-query.html I'm trying to learn about what c

How to select date only from database that storing dob as datatype timestamp without timezone in java

I have a table in PostgreSQL that stores dob as datatype timestamp without timezone example value '1997-12-03 07:00:00'. My entity class is as follows @Tab

Two concurrent saveAll actions with a unique constraint

I am not using any type of locking. Is it possible that two concurrent saveAll requests trying to save the same set of records could collide with each other and

QueryDSL Predicate for use with JPARepository where field is a JSON String converted using an AttributeConverter to a List<Object>

I have a JPA Entity (Terminal) which uses an AttributeConverter to convert a Database String into a list of Objects (ProgrmRegistration). The converter just us

How to make DataJpaTest flush save automatically?

I have an Employee entity with the following column: @Entity class Employee { @Column(name = "first_name", length = 14) private String firstName; and I hav

About the use of JPA ElementCollection

I used the ElementCollection annotation on a List object, @ElementCollection(fetch = FetchType.EAGER) @CollectionTable( name = "a", joinC

postman returning "status": 404, "error": "Not Found", for the spring boot

Thank you in advance, Hello I am new to spring boot. I am facing a problem with spring boot. When I run my URL in postman it shows an error below. I have also u

Spring Boot and AWS RDS Read Replica

Here I am trying to achieve the below in AWS RDS. I have a MySQL database instance running. I am thinking of creating a read replica so that I will have some ex

How do I use the same parameter multiple times in my Query using JPA?

How do I use a parameter multiple times in the same query? Here is my Query: @Query(value = """ SELECT * FROM person WHERE first_name = ? or last_name =

JPA Specification predicate for querying latest/newest/most recent records

I'm trying to convert the below query into a JPA specification in order to enable more flexible querying of my Rule entities, but i don't find any way of transl

Set of String is not acting normal in Spring JPA Projection Interface

I am using Projection Interface to return a partial view of an Entity, and the partial view contains a Set of String. I expect the Set works as normal but its n

Is it possible to use data.sql without schema.sql

I want to initialise schema using spring.jpa.generate-ddl=true and then populate using data.sql. I tried it but it doesn't seem to work without schema.sql. Any

Meaning of Long in JPARepository?

What is Long here and what on basis do we configure this in JpaRepository? public interface FirstRepository extends JpaRepository<First, Long> { }

405 Method not allowed despite exposing all methods when using RepositoryRestConfiguration.disableDefaultExposure()

I don't want to expose my repositories by default and it looks like RepositoryRestConfiguration.disableDefaultExposure() does exactly what I want; however I get

org.springframework.beans.factory.UnsatisfiedDependencyException Spring JPA

i need help to solve this error here, for my college project. I created an online database and from there I tried to develop a service to be consumed later, the

Which is a better approach to persist the spring state machine context or restore the state machine using the state enum on entity object?

I am new to spring state machine and trying to understand which is a better approach whether to persist the state context in a database or to restore the state

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

Is it a good or bad convention to update entity / row without calling save() in hibernate / spring-jpa?

Recently I found it not necessary to call repository.save() if within a @Transactional block. Hibernate / Spring-JPA will update row automatically when exiting

Spring Data: can I create a method in the @Repository with a name what return list of object if String equals to constant?

Guess easier if I show you my example: @Entity class User { Long id; Status status; } enum Status { NEW("N"), DELETED("D") } I have an AttributeCon

Hibernate / Spring Data - get executed sql queries count

I'm working on presentation in which I would like to show difference in number of executed sql queries between deleteByPost() method with and without custom que