Category "spring-data-jpa"

How to test a repository with a user that have update rights and the test needs tot add records to the database

I use mysql and spring 5, spring-data-jpa and spring-boot and JUnit5. This must be a common problem but I don't see te sollution. I have to test a repository wi

How to add complex inner query to @Query annotaion

normal sql query which work correctly in db in sql developer passing values for bID and period. SELECT * FROM A WHERE abcID IN (SELECT abcID FROM B WHERE bID=1)

Is there a @LastAccessedTimestamp in JPA

I want to store the last read time in a Date column when ever someone tries to load or fetch(select query, findBy methods) a entity I had a look at @PostLoad as

Refresh the datasource on password rotation in SpringBoot Application

Can someone please guide me, how I can refresh the datasource whenever the password is rotated for the database. Basically I don't want any manual step to refre

Multiple list of Data comming in API when using ManyToOne Relationship

CarMake.java @Getter @Setter @EqualsAndHashCode @NoArgsConstructor @Entity public class CarMake { @SequenceGenerator( name = "car_make_sequence"

Unable to connect IBMi machine with Spring Data & JPA

Trying connect IBMi machine by using Spring Data & JPA, but it's generating the error: org.springframework.beans.factory.BeanCreationException: Error creati

Do Jpa methods execute with or without transactions by default?

I am using JPA with hibernate for mysql. I want to know whether jpa query methods will execute with or without transaction by default. I am not using transactio

Spring Data JPA with hibernate annotations

We have a large code base using Hibernate and JPA with hand-made DAO Layer. Entites are mapped with JPA annotations (javax.persistence) and if needed, hibernate

Lombok - Hibernate @OneToOne in same class - StackOverFlowError

I'm working with 2 tables: Person and City. I have a @ManyToOne relationship which worked fine. (many persons can belong to one city). Then I needed to create a

Is it possible that the changes made by a transactional method are visible in database before the transactional method ends

Two Spring boot (spring data jpa) Application A1 and Aplication A2 both read/write to a table named T1. T1 -> ID, data1, isDeleted columns My requirement is

Truncating, Selecting data from multiple tables using joins and then inserting data into separate table in spring boot

I am using a spring boot application. I have multiple tables and using inner joins, I want to populate a temp table. Before populating, I have to truncate the t

How to design a Spring REST server with a parallel business logic function

I'm currently building server software in Java. I already have a running backend, which is build with Spring Boot. It has an REST interface to read and write da

How to handle 2 OUT user-defined custom data types from Java Spring Data JPA @NamedStoredProcedureQuery defined on @Entity class?

UPDATE: I have tried implementing the SQLData interface for my Financial.class and PersonalInfo.class Java POJOs defined on my @NamedStoredProcedureQuery for th

After update to spring boot 2.6.3 from 2.5.X hibernate does not work in some query syntax

someone could help me to solve this bug? i have update spring boot from 2.5.x to 2.6.3 and now the query like: @Query("select count(s.subjectId) from PreChe

When I'm trying to run this query I keep getting this error and I could not figure out why

This is the DTO class public class InvoiceCountValueDto { private String ackNumber; @DateTimeFormat(pattern = "yyyy-MM-dd") @Temporal(TemporalType

Using Enum values in @Query JPQL and @CreationTimestamp hibernate

I am stuck with some problem about using JPQL with spring data Here is my code snippets @Entity @Table //... public class Parent { @Id private Stri

Simple spring data jpa transaction to small table on mysql database is hanging indefinitely

I have a spring data jpa query that reads a row from a mysql table with a pessimistic lock. In my environment, this table only contains one row so it should be

Spring Data JPA (Postgres) - Insert into One table, reading the foreign key from a table that contains static data

I am currently working with Spring Data JPA, specifically Postgres. Our database is highly Normalized. In some scenarios we have some tables that contains stati

why a project that contain spring data dependency doesn't work on tomcat9?

I am trying to deploy a small springboot app on tomcat9 , the tomcat9 is on ubuntu 20 on my account in digital ocean . the problem when i am adding the spring d

JPA Specification, using like againt List<String>

I'm having a problem to use like on List field. Entity class: @Entity public class ToSearch{ @Convert(converter = CollectionConverter.class) private Li