Category "jpa"

Error creating bean with name 'entityManagerFactory' caused by java.lang.IllegalStateException

In the code I do not even use entityManagerFactory. I extend JPARepository and for creating the tables I have entities annotated with @Entity (using javax.persi

Spring JPA Paging to Stream

We are currently using cockroach DB, but this doesn't support returning X records at a time presumably due to lack of cursor support. This means that when tryin

spring data extension for quarkus datasource name

I want to use the spring data repositories in my quarkus application with jpa. As long as I use the default datasource and no named persistence unit, I'm able t

Checkmarx report sql injection JpaRepository

im running Checkmarx on my code and im getting an sql injection vulnerability. this is the simplified method im using public String assignRole(String userId, St

JPA CriteriaBuilder ManyToOne and null values

I'm trying to create a Specification for filtering a table. This table has 2 @ManyToOne relationships (that can be null) and I'd like to apply the filter inside

How can we test for the N+1 problem in JPA/Hibernate?

I have a N+1 problem, and I’d like to write some kind of automated regression test because it impacts performance very much. I thought about spying the E

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 do I set up a recursive, many-to-many relationship WITH an association class using JPA?

So I'm trying to create a pharmacy database that, among other things, keeps track of drug-to-drug interactions. I have a Drug entity with various members and as

About the use of JPA ElementCollection

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

problem with postgresql sequence and hibernate

I often read this site, but this is the first time I write, hope I won't make mistakes and apologize for my bad english. I get to the point: I have to develop c

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