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,185
questions
0
votes
0
answers
20
views
Unable to Find SAP Olingo JPA Processor v4 Artifacts in Maven Repository
I'm trying to use OData 4 with Java, utilizing the Apache Olingo library. However, I've run into a roadblock. The Olingo library for OData v4 doesn't include any data access layer. I discovered that ...
0
votes
0
answers
26
views
OpenApiGenerator not setting modelAnnotations on generation
My task in the build.gradle.kts:
tasks.named<org.openapitools.generator.gradle.plugin.tasks.GenerateTask>("openApiGenerate") {
generatorName.set("spring")
inputSpec....
1
vote
0
answers
27
views
How to setup optimistic locking for overlapping datetime?
I am trying to make a booking system, where users can book a booking at a location for a certain time period. The problem I am having is, 2 entries that happen at the same time and overlap in the time ...
-1
votes
0
answers
31
views
spring data jpa and queryDSL with a little complex sql
I used spring data JPA and QueryDSL to find data in the database;
Table A :
id
name
age
1
joe
20
2
jack
22
3
rose
24
Table B :
id
realtion_id
type
aid
1
13
9
1
2
13
0
2
3
13
8
3
here is an ...
0
votes
0
answers
18
views
Predicates hibernate join a self referenced table
I have 3 entities : EntityEntity, EntityTaskEntity and EntityTaskStatusEntity.
EntityEntity has the following properties:
@Entity
@Table(name = "entities")
@Getter @Setter
@...
0
votes
0
answers
27
views
How to find out which column is failing if type is number and it exceeds the length in JPA insert operation
I am trying to insert a record in a Oracle 11g table which have around 100 columns.
repository.saveAndFlush(nextObj);
When i am inserting JPA is throwing exception like below, it not telling me ...
0
votes
0
answers
17
views
How can I mix inheritance strategies (SINGLE_TABLE and TABLE_PER_CLASS) with Hibernate 6.5/JPA?
I am trying to design an entity model with inheritance that also supports maintaining draft and publish states of the entities. I am using JPA annotations with Hibernate implementation (version 6.5). ...
0
votes
1
answer
56
views
Why I can not look for entities between joined tables?
I have two entities User and Phone.
User Entity:
@Getter
@Setter
@Accessors(chain = true)
@Entity
@Table(name = "user_table")
public class User {
@Id
@GeneratedValue(strategy = ...
0
votes
0
answers
22
views
JPA relationShip ManyToOne from embedded to embeddable
I have next class embeddable:
@Data
@Embeddable
public class JobOrderViewPK2 implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name = "ID")
...
0
votes
0
answers
22
views
Is possible not to apply JPA EntityListener during test, but only real execution?
I'd like to apply EntityListener only during real execution, but not test. Because the EntityListener currently I use changes Entity's property on read, so it might be confusing when verifying column ...
1
vote
0
answers
18
views
If I use Spring Data JPA without @Transactional, will the entity not be in a Managed state in the persistence context?
I used Spring Data JPA's JpaRepository(3.2.2), and after checking the implementation, I found out that it uses jakarta.persistence.EntityManager to perform find operations. As far as I know, when ...
0
votes
0
answers
22
views
How to handle multiple self referencing foreign keys in Hibernate [duplicate]
I have a MYSQL table that has 2 foreign keys to other rows of the same table. (for simplicities sake, I have changed it to a person table, that's not what I am trying to achieve, but similar structure)...
0
votes
0
answers
36
views
How to define query method in spring data jpa if one of the query parameters is fixed?
If I have a customer table with columns cus_no, is_valid and create_time where cus_no corresponds to cusNo attribute (with data type String) of customer object, is_valid corresponds to isValid ...
0
votes
0
answers
29
views
How to match column on timestamp and temporal in java spring boot
Here is my entity which is saving the timestamp
@Temporal(TemporalType.TIMESTAMP)
private Date transactionTime;
and here is my Service layer to fetch the data based on transactionDate
Timestamp ...
0
votes
0
answers
24
views
JPA delete parent through child in in ManyToOne relationship using CascadeType.all
I want to delete the parent if the child gets deleted while the parent doesn't have any other children.
If i use CascadeType.ALL i get a foreign key error when attempting to delete a child while more ...