Questions tagged [jpa]
The Jakarta Persistence API (formerly Java Persistence API) (JPA) is a Java specification for accessing, persisting, and managing data between Java objects/classes and a relational database. JPA was defined as part of the EJB 3.0 specification as a replacement for the EJB 2 CMP Entity Beans specification. JPA is now considered the standard industry approach for Object to Relational Mapping (ORM) in the Java Industry.
52,163
questions
0
votes
0
answers
10
views
Title: Improving Performance for Netting and Settlement Cron Job in Spring JPA
I am working on a netting and settlement process in the banking and
finance sector. Specifically, I need to run a cron job every 4 hours
and 15 minutes to retrieve data from the transaction table for ...
0
votes
0
answers
6
views
Hibernate: Generate non-id value from sequence
I have an entity with 2 fields which both use the same sequence, but when debugging I see that only the id field value is being generated:
@Table(name = "MY_TABLE")
public class MyEntity {
...
0
votes
0
answers
3
views
release conenction in JPA multitenancy connection provider
How to handle exception in releaseConenction(String tenantIdentifier, Connection connetcion) method which implements MultiTenantConnectionProvider. How do we ensure the connetcion will be closed if ...
0
votes
0
answers
8
views
Nested Interface Projections in Spring Data JPA
I am working on a spring boot based application where I want to utilize interface based projection as I want to select partial column from my mysql database.
I have a CourseEntity.java class with a ...
0
votes
0
answers
11
views
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not extract ResultSet
Here the error:
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not extract ResultSet
at org.hibernate.internal.ExceptionConverterImpl.convert(...
0
votes
1
answer
24
views
JPA EntityExistsException thown when saving and object
I have the following 2 objects in my project that share the common Composite Primary Key as and ID:
@Entity
@Immutable
@Cacheable(true)
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
@Table(name = ...
0
votes
0
answers
7
views
QueryDSL join(a, b) vs join(b).on(): Why does @SQLRestriction behave differently?
Intro:
I'm using QueryDSL with Hibernate in a Spring Boot project. I've noticed a difference in the way @SQLRestriction is applied when using join(a, b) versus join(b).on(). Specifically, when using ...
0
votes
0
answers
45
views
Fix naming convention to remove underscores from Hibernate JPA
Without any changes it was prepending the class UserProfile and BaseModel id (user_profile_id). What I wanted was just ID in the table. When I changed to use
<property name="...
-1
votes
1
answer
23
views
Issue with Changing @Table Annotation to "users" in JPA Entity Class Using H2 Database
I'm encountering an issue with my Java application where changing the @Table name in my entity class causes the application to fail during tests and runtime. Here are the details:
Originally, my ...
-1
votes
0
answers
11
views
Row updated in another transaction error unless there is a breakpoint on the save method
I have 2 methods that update an entity and have similar functionality, but I have inherited the codebase with little testing so don’t want to do a refactor yet.
However, there is a bug in one of these ...
0
votes
1
answer
16
views
JPA Subquery return object and use on query multiselect
I'm have a java spring application that use a criteria query. The query has a multiselect and one of the values is a subquery that bring an complete entity. The application work on original enviroment ...
-2
votes
1
answer
30
views
JPA get highest value in column with where condition
I'm using a JpaRepository to access a table in my database. I defined the table through an entity. My goal is, to get the highest value in the wordNumber column. But I also have to distinguish entries ...
0
votes
1
answer
28
views
How to Handle Indexes for @MapsId in JPA: Should FK and PK Share the Same Index?
I am using the @MapsId annotation in JPA to map a foreign key (FK) to a primary key (PK). According to the @MapsId annotation, the FK and PK share the same value. However, when I checked the database ...
-2
votes
0
answers
22
views
How to set foreign key constraint order by JPA annotation? [closed]
I'm using JPA in a Spring-Boot application with JPA (jakarta.persistence Annotations).
The creation of my DB schema (hbm2ddl=create) failed with an:
⚡ Foreign key constraint is incorrectly formed ...
0
votes
0
answers
35
views
JPQL did not translated to SQL correctly when using Window Functions
Models:
@Entity
@Data
//This is main entity
public class Collection {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
@OneToMany(mappedBy = &...