Skip to main content

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
9 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
  • 127
0 votes
0 answers
12 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
39 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
11 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
35 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
27 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
72 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
16 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
-1 votes
0 answers
13 views

spring boot data jpa batch insert performance issue - improvement suggestion

I am facing an issue while inserting 1,00,000 records at once using spring data JPA repository. When we execute repository save-all method with list of objects, it is taking a lot of time if we use ...
Maha Sonu's user avatar
0 votes
0 answers
26 views

UPSERT native SQL query for Collection as @Param of JPA Repository method

I need to iterate over collection of Enteties and apply UPSERT for each element atomically. As i see it - just need to send this collection into SQL query by SpEL. I know, what i can iterate over ...
Andrew Yatkin's user avatar
-1 votes
0 answers
34 views

Hibernate + Spring Boot: Handling "More than one row with the given identifier was found" Exception

I'm working on a Spring Boot application with Hibernate and encountering an issue where Hibernate throws "More than one row with the given identifier was found" exception. I'm using custom ...
Karthik Kumar.m's user avatar
0 votes
1 answer
22 views

Entity Inheritance and query filtering

I'm trying to achieve a very basic from SQL point of view operation but using Spring Boot and JPA This is my Java data model: @MappedSuperclass public abstract class BaseEntity { @Id @...
Witek's user avatar
  • 55
-2 votes
0 answers
28 views

How to persist object with ManyToOne field in JPA? [closed]

Having trouble understanding/ persisting a Listing record in my postgresql db through jpa. The Listing model is related to User by ManyToOne. Assuming the user is already created before hand, I want ...
benwl's user avatar
  • 436
1 vote
1 answer
48 views

Issue with @ManyToOne Lazy Loading: Unable to Find Entity by ID

Edit I added an attribute that can be the problem, it had the same column name in the yEntity and the xEntity, but he is not part of the relationship (the Integer yEntity in yEntity who is a reference ...
maxime Lassort's user avatar
0 votes
0 answers
25 views

Why does Blaze-Persistence project count queries for pagination despite potential performance issues?

I'm using Blaze-Persistence and noticed that its offset pagination feature projects the count query as follows( concisely reduced ): select *, (select count(*) from Entity) from Entity e inner join ...
InJun C's user avatar

15 30 50 per page
1
2 3 4 5
3479