Top "Jpa" questions

The Java Persistence API (JPA) is a Java specification for accessing, persisting, and managing data between Java objects/classes and a relational database.

Correct use of flush() in JPA/Hibernate

I was gathering information about the flush() method, but I'm not quite clear when to use it and how to …

java hibernate jpa transactions persistence
Create the perfect JPA entity

I've been working with JPA (implementation Hibernate) for some time now and each time I need to create entities I …

java hibernate jpa equals
How to set up default schema name in JPA configuration?

I found that in hibernate config file we could set up parameter hibernate.default_schema: <hibernate-configuration> <session-factory&…

java hibernate spring configuration jpa
What is the difference between persist() and merge() in JPA and Hibernate?

What is the difference between persist() and merge() in Hibernate? persist() can create a UPDATE & INSERT query, eg: SessionFactory …

java hibernate jpa orm entity
How does DISTINCT work when using JPA and Hibernate

What column does DISTINCT work with in JPA and is it possible to change it? Here's an example JPA query …

java jpa distinct
How to create and handle composite primary key in JPA

I want to have versions from the same data entry. In other words, I want to duplicate the entry with …

java jakarta-ee jpa composite-primary-key
Spring Data JPA Update @Query not updating?

I have an update query: @Modifying @Transactional @Query("UPDATE Admin SET firstname = :firstname, lastname = :lastname, login = :login, superAdmin = :superAdmin, preferenceAdmin = :…

java jpa spring-data
Confusion: @NotNull vs. @Column(nullable = false) with JPA and Hibernate

When they appear on a field/getter of an @Entity, what is the difference between them? (I persist the Entity …

java hibernate jpa persistence hibernate-annotations
JPA: How to get entity based on field value other than ID?

In JPA (Hibernate), when we automatically generate the ID field, it is assumed that the user has no knowledge about …

java hibernate jpa
How to choose the id generation strategy when using JPA and Hibernate

I was going through Id generation section of the Hibernate reference guide and "java persistence with Hibernate" There are quite …

java hibernate jpa uniqueidentifier id-generation