Skip to main content
The 2024 Developer Survey results are live! See the results

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.

0 votes
0 answers
4 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 ...
Hello World's user avatar
0 votes
0 answers
5 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 { ...
Clayn's user avatar
  • 29
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 ...
aryaD's user avatar
  • 3
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 ...
Usama Abubakar's user avatar
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(...
Kutman Salamatov's user avatar
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 = ...
Martin819's user avatar
  • 490
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 ...
Goose's user avatar
  • 1
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="...
JustinKSU's user avatar
  • 5,009
-1 votes
1 answer
22 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 ...
quarks's user avatar
  • 34.7k
-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 ...
iamsimonsmale's user avatar
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 ...
Felipe Schultz's user avatar
-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 ...
Fi0x's user avatar
  • 144
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 ...
Yusuf BESTAS's user avatar
-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 ...
Tobse's user avatar
  • 1,312
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 = &...
SoT's user avatar
  • 1,143
-1 votes
2 answers
39 views

any scenario's to use @Transactional annotation at Repository delete method?

I am reveiewing the code for one of the senior member for the first peer review so he added @Transactional annotation at custom repository with delete method. The custom Repository delete method is ...
Anil Nivargi's user avatar
  • 1,663
-1 votes
0 answers
22 views

JPA Unit Test Error: Table not found During ALTER TABLE Execution

I am encountering an error in a simple JPA unit test where it attempts to execute an ALTER TABLE command on a table that it claims does not exist. Here is the relevant error message: INFO: Property ...
quarks's user avatar
  • 34.7k
0 votes
0 answers
31 views

Issuse with relationship mapping MapKeyEnumerated with an Entity List as values

I have this Entity @Entity public class MealPlanADay { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @JsonIgnore private Long id; //@OneToMany(cascade = CascadeType.ALL,...
Omar122's user avatar
0 votes
0 answers
24 views

Hibernate seems to ignore the dialect I specify

I'm using Olingo JPA for producing an OData API. The database I'm connecting to doesn't support the 'LOCATE' function; instead it implements 'POSITION'. This seems to be true of a few databases: ...
Person's user avatar
  • 1
0 votes
0 answers
28 views

How to Convert a Complex SQL Query to Hibernate Criteria API

I'm learning about Hibernate's Criteria API and would like to know how to convert this particular SQL query to Criteria API. Here is the SQL query I’m working with: select s1.score as score,count(s1....
random guy's user avatar
0 votes
1 answer
26 views

Can i customize result of @ManyToMany of entity?

Here is 2 entity obj: import jakarta.persistence.*; import lombok.*; import java.util.Set; @Entity @Table(name = "category" , uniqueConstraints = { @UniqueConstraint(...
Kiên Phạm Thanh's user avatar
0 votes
1 answer
65 views

IntelliJ IDE Cannot Find javax.annotation.processing.Generated Symbol While mvn test Works Correctly

I am having a problem with my project configuration and running the program and unit test. When running with mvn test the JUnit test executes propertly, but when executing from within the IntelliJ IDE,...
quarks's user avatar
  • 34.7k
0 votes
1 answer
13 views

JPA, removing parent cannot remove all children

I have a @OneToOne relation between Parent and Child tables , I need to delete all child if happen delete on parent because children doesn't have meaning without parent ! Parent Entity : @Entity(name =...
KronosOne's user avatar
  • 147
0 votes
0 answers
21 views

Impossible to use DATEDIFF in java JPA criteria queries?

For the life of me, I cannot figure this out. I want to select entities from my H2 database, and get the difference between an entities timestamp column and a passed parameter. trying var dateDiff = ...
diet coke's user avatar
-1 votes
0 answers
167 views

java: cannot find symbol - symbol: class Generated location: package javax.annotation.processing during build

What are the possible errors that are causing this: /home/api/target/generated-sources/annotations/org/example/core/user/model/User_.java:3:35 java: cannot find symbol symbol: class Generated ...
quarks's user avatar
  • 34.7k
0 votes
0 answers
15 views

Handling Date comparisons in MYSQL 8 and Spring boot without Milliseconds

We are upgrading our project from Mysql 5 to Mysql 8. there is weird issue coming in db queries in date handling. On MySQL 5, while saving data to db, the date used to be saved with 'yyyy-MM-dd HH:mm:...
amangautam1's user avatar
-1 votes
1 answer
47 views

Why does VsCode generate classes with both jakarta.data.metamodel and jakarta.persistence.metamodel?

For some time now, I've had a problem in VsCode where I end up with duplicate generated sources. For example, let's take the SiteEntity entity. In /target/generated-sources/annotations/com/.../sites, ...
Fred Nobre's user avatar
0 votes
0 answers
29 views

Hibernate generating N(N+1) Updates for each Insert

On Hibernate 6.4.4 and 6.4.9, I am observing the following odd behavior. In a loop, I am doing the following: for (loop control) { SomeObject object = new SomeObject(contents); repository....
IVR Avenger's user avatar
  • 15.4k
-2 votes
0 answers
127 views

Unable to open JDBC Connection for DDL execution ["encrypt" property is set to "true" and "trustServerCertifi

10:12:20 PM: Executing ':ReportingApplication.main()'... > Task :compileJava UP-TO-DATE > Task :processResources UP-TO-DATE > Task :classes UP-TO-DATE > Task :ReportingApplication.main() ...
Ruslan Şirbidov's user avatar
-1 votes
0 answers
18 views

How do i switch between different schemas in spring jpa and hibernate dynamically

i have a multi tenancy application written with spring boot, keycloak, flyway and postgres, i have been finding it difficult to switch from one schema to another, note i have done a lot of research ...
David Ogbodu's user avatar

15 30 50 per page
1
2 3 4 5
1739