Category "spring-data-jpa"

How to get an object of current user in Spring Boot+JPA

I need to create shopping cart. I have a model CartItem: @Entity @Table(name = "cart_items") public class CartItem { @Id @GeneratedValue(strategy = Generation

Spring JPA not returning Foreign keys in response

I have a database with some entities, ( in parent child relationship )I can say and when When I try to make a query to child table to get all the rows, I only g

JPA @Version behavior when data is changed from unmanaged connection

Enabling @Version on table Customer when running the tests below @Test public void actionsTest1 () throws InterruptedException { CustomerState t = customerS

How to persist List<Object> as jsonb in hibernate

Below the Entity trying to persist : @Data @Entity @Table(name = "REQUEST") @TypeDef(name = "jsonb", typeClass = JsonBinaryType.class) public class Request { @

How to call a stored procedure in Spring Boot?

A query for a stored procedure for multiple delete yield an error message shown way below. CREATE OR REPLACE PROCEDURE delete_dim_page(_page_id bigint) LANGUAG

Ecommerce table problem mapping in hiberate

I have created a product table which has four foreign keys mapping to different tables and creating relationship of ManyToOne. so i created manytoone relationsh

Nesting one-to-one relationship in already owned entity

I'm working on a project with multiple user data mapped to a user by one-to-one relationships in the entities. I'm in the process of adding another entity which

Spring JPA alter table by creating extra column

I am implementing Spring-JPA application . In the model class I am using @Table annotation to map the table with the model class and against the column name usi

Spring Data Jpa @query behaviours

Can anybody please tell me @Query annotation will support DB independence query mechanism Example: public interface UserRepository extends JpaRepository<Us

How to access cross-field values in QueryDSL QuerydslBinderCustomizer?

How can I access other query parameter values inside QuerydslBinderCustomizer? My goal is to create a departure.between(min, max) binding, that I want to derive

Hibernate PessimisticLockingFailureException Occurring at a particular time everyday

I have a Spring Boot application and hibernate exception comes every day at a particular time at night. The exception is : could not execute statement; SQL [n/a

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 =