Category "jpa"

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

@Transactional spring JPA .save() not necessary?

I understand that if we use annotation @Transactional. "save()" method is not necessary. Is it exact? And for my example: @Transactional void methodA() { .

How to check if token expired in java?

I have user which have: id, username,password, tokenExpires which is Date. When i generate token i generate a string, how to check if token is not expired?

how to make findby with composite key in spring data - jpa -hibernate ? @EmbeddedId

@Embeddable public class AccountTransactionId implements Serializable { private String trxDate; private String acctNo; private int trxNo; } @Entity

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

Nested ID class required to be named like relationship, even though not being a derived identifier?

There's chapter 10 in the book "Pro JPA 2 in Java EE 8", section called "Multiple Mapped Attributes", there the well-known department-project example using @IdC

JPA Inheritance with JOINED strategy

I've seen many posts about inheritance but nothing match my problem. I try to build a correct objects model: The root class @Entity @Inheritance(strategy = I

The class 'javax.persistence.Convert' is required to be in the selected libraries

When selecting a user library as the JPA implementation in Eclipse Dali's project settings, the following error message is displayed: The class 'javax.persi

Axon Aggregate Identifier Type Converter

PROBLEM: In an aggregate-state Axon SpringBoot application @AggregateIdentifier is of type UUID and PostgreSQL database column is of type UUID. When persisted o

select query inside loop - Database connections in JPA

In my Spring MVC application, I have @Transactional annotated method inside which I make call(select query) to DAO layer inside for loop. If my input list size

Performance insert by JPA Spring-boot with Oracle database

the first thanks for your time. I am trying to insert data to the database by JPA(spring-boot), the project is using Oracle. Currently, Insert 5000 record, it t

How to access nested Json Object Value into JPA Entity Class

I have a payload like this { "eventId":"ep9_0579af51", "eventTime":"5/11/2022 5:50:58 PM", "eventType":"UpdateTransaction", "meta":{ "us

detached entity passed to persist - on findByMethod

I understand the error message and i know how to solve it, but i want to know why it occurs in this specific place especially on a find method. I created a mini

Cannot access org.springframework.data from my Java Classes

I'm working on an online tutorial, and in the step where I need to work with databases and add jpa, I cannot access it in my project. I have successfully put t

CteInsertStrategy can only be used with Dialects that support CTE that can take UPDATE or DELETE statements as well

Hibernate 6.0.1 with PostgreSQL JDBC driver 42.3.5 causes the following exception: java.lang.UnsupportedOperationException: CteInsertStrategy can only be used w

Spring Boot + Hibernate - Insert query getting slow down

I am working on one spring boot application. Here I have 100,000 records that are inserted into db by different process. and its inserting one by one. I can't d

Find a record containing all or a part of a list of id of other table in a many-to-many relation on MySql/Jpa?

In my web application, I have 3 tables: TAB A: Recipes (id, name) TAB B: Recipes_Ingredients(id, fk_recipe,fk_ingredient, quantity) Bridge table TAB C: Ingredie

Why `spring-data-jpa` with `spring-data-cassandra` won't create cassandra tables automatically?

I'm using spring-data-cassandra:3.1.9 and the properties looks like : spring: data: cassandra: keyspace-name: general_log session-name: genera

How to remove an element from a Set inside a Page of items based on a Condition using Java 8

I have a Page of Farmers coming from a JPA repository call findAll method. Each Farmer consists of a Set of Farms which are also coming in the repository call l