This tag is for questions specifically about new features of version 2.2 of the Java Persistence API.
Questions tagged [jpa-2.2]
63 questions
1
vote
1 answer
Netbeans 12.0 - Generating Entity Classes from DB uses Java Date class instead of LocalDate
I am using Netbeans 12.0, and to create my Entity classes for my DB tables, I use Netbeans Entity Classes from Database. It works great other than the fact it defaults all my date columns to the pre Java 8 Date classes, and I recently discovered…
![](../../users/profiles/6950859.webp)
cela
- 2,059
- 3
- 19
- 37
1
vote
1 answer
Why is hibernate cascading by default when I don't have any CascadeTypes set
I'm running into the following exception when I'm trying to persist new swipe objects:
javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: org.munch.database.models.bunch.Munch
Here is…
![](../../users/profiles/5978198.webp)
Aleks Azen
- 11
- 1
1
vote
2 answers
JPA criteria filter by related entity without join
I want to know how to use JPA Criteria API to filter entity by related entity's foreign key.
Let's say i have two entities as the following:
public class Employee {
@Id
private Long id;
...
@ManyToOne
private Department…
![](../../users/profiles/4016495.webp)
Mohammad Awwaad
- 403
- 3
- 10
1
vote
1 answer
Hibernate : Error in persistence.xml - Element 'persistence-unit' cannot contain text content. The content type is defined as element-only
I'm using Hibernate and the below persistence.xml was working fine. But after creating a new JPA entity from Table in eclipse, persistence.xml is giving error - Element 'persistence-unit' cannot contain text content. The content type is defined as…
![](../../users/profiles/6931044.webp)
Neethu S
- 13
- 3
1
vote
1 answer
EclipseLink throws JPQLException on using SELECT ... AS in a constructor expression
I have a JPQL query with a constructor expression using EclipseLink 2.7.5.
It fails with:
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.7.5.v20191016-ea124dd158): org.eclipse.persistence.exceptions.JPQLException
Exception…
![](../../users/profiles/396732.webp)
Kawu
- 12,601
- 31
- 109
- 189
1
vote
1 answer
What is best way to JPA repository update?
I am extending my question here: Spring Data JPA Auditing not working for the JpaRepository update method with @Modifying annotation, why?. I am using Spring Boot + Spring Data JPA.
I've developed update
@Modifying(clearAutomatically =…
![](../../users/profiles/2929562.webp)
Pra_A
- 7,134
- 12
- 89
- 170
1
vote
1 answer
Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "student_id" violates not-null constraint
I am developing Spring Data JPA Postgres example. In this example I make the relationship between Student and StudentMember.
Error:
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at…
![](../../users/profiles/2929562.webp)
Pra_A
- 7,134
- 12
- 89
- 170
1
vote
1 answer
Unable to generate JPA metamodel casses with gradle and sts
There is a lot of different information of how to setup project so generating JPA metamodel works on build, but non of those works for me. I'm using Java 11, gradle 5.4.1 and STS (tried both STS 3.9.8 and 4.2.1).
My gradle setup for annotations…
![](../../users/profiles/3939481.webp)
Mario Rudman
- 1,477
- 2
- 10
- 15
1
vote
0 answers
What can cause random slowdowns for a JPA native insert query?
I have a NativeQuery which copies about 1000 rows (selects and inserts with some columns changed).
The problem is that sometimes (about 1/3 of the runs) executeUpdate takes 50 ms and sometimes (2/3 of the runs) it takes 1500 ms.
The same query is…
![](../../users/profiles/261181.webp)
Aivar
- 6,112
- 3
- 40
- 69
1
vote
1 answer
JPA persistence.xml I want it to connect to MariaDB but it always connects to hsqldb
I have a java webapp,
persistence.xml
![](../../users/profiles/1869981.webp)
ThanhLoyal
- 303
- 1
- 11
1
vote
0 answers
1
vote
1 answer
How to use a @ConstructorResult with a Set field
I'm trying to create a @NamedNativeQuery with a @ConstructorResult for a class that has a field with a Set of enum values.
VeterinarianJPA.java:
@Entity
@Table(name = "veterinarians")
@Setter
@Getter
@NoArgsConstructor
@NamedNativeQueries({
…
![](../../users/profiles/3932572.webp)
Paul Campbell
- 17
- 4
1
vote
2 answers
EclipseLink: Entities not loaded
I have a JPA-Project, which I'm trying to update to JPA 2.2.0 and EclipseLink 5.7.1 since I ran into bug 429992 of EclipseLink. With the new versions in place, I'm not able to execute my application anymore – EclipseLink throws an exception similar…
![](../../users/profiles/9969672.webp)
Janik
- 13
- 5
1
vote
1 answer
No Persistence provider for EntityManager Hibernate 5
I have the following project structure which is a multi-module maven project. My issue is in the persistence configuration (located in the model module). It generates my war without returning errors but when it comes to instanciate the…
![](../../users/profiles/9564799.webp)
A. Gorin
- 51
- 1
- 6
1
vote
0 answers
JPA criteria API join on attributes instead of class root
I have
@Entity
public class Entity0 implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Long id;
@OneToOne
private Entity1 entity1;
...
}
@Entity
public class Entity1 implements…
![](../../users/profiles/1797006.webp)
Karl Richter
- 6,271
- 17
- 57
- 120