From 0372e0fba525a3fed2c73e1a319870c06a326a5f Mon Sep 17 00:00:00 2001 From: Mladen Savic Date: Mon, 2 Aug 2021 10:52:05 +0200 Subject: [PATCH] EntityNotFoundException in Hibernate - fix persistence unit config to allow multiple test to run in conjunction. --- .../com/baeldung/hibernate/entitynotfoundexception/Item.java | 1 - .../hibernate-jpa/src/main/resources/META-INF/persistence.xml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java index ee6f677d7d..3abed00eb8 100644 --- a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java +++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java @@ -15,7 +15,6 @@ public class Item implements Serializable { private String name; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "category_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) - @NotFound(action = NotFoundAction.IGNORE) private Category category; public long getId() { diff --git a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml index 29cd4faf05..e895ac6ba9 100644 --- a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml @@ -114,7 +114,7 @@ - + @@ -132,7 +132,7 @@ - +