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.

jpa
0 votes
0 answers
7 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
3 answers
1k views

Can i cascad persist and merge in same time?

I have 2 objects Network : @Entity @Table(name = "network") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Network implements Serializable { private static final long ...
8 votes
4 answers
9k views

WrongClassException: Object [id=null] was not of the specified subclass

I have a model like this one below: @Entity(name = "request") public class VisitRequest { @Id @GeneratedValue private Long id; @OneToMany(mappedBy = "visitRequest", cascade = CascadeType.ALL,...
39 votes
4 answers
95k views

Hibernate Named Query Using Like and % % operators?

In my Hibernate JPA Sample code.. public List<AttendeesVO> addAttendees(String searchKeyword) { TypedQuery<AttendeesVO> query = entityManager.createQuery(" select at from AttendeesVO ...
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 ...
-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 ...
9 votes
1 answer
9k views

How to LOCK TABLE ... do stuff ... UNLOCK TABLE with Spring Boot?

The idea is basically to extend some Repositories with custom functionality. So I got this setup, which DOES work! @MappedSuperclass abstract class MyBaseEntity { @Id @GeneratedValue(strategy ...
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="...
13 votes
4 answers
21k views

Retry mechanism for optimistic locking (spring data + JPA)

We decided on using optimistic locking in our web application in order to increase concurrency and without the using of pessimistic locking. We are now on a lookout for retry solutions. We would ...
0 votes
2 answers
587 views

How to skip some of the entity from ddl update

have several javax.persistence.Entity most of them are created for the current module, so keeping spring.jpa.hibernate.ddl-auto = update Since some of the tables are already there. I was wondering how ...

15 30 50 per page
1
2 3 4 5
3479