diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml
index 87fa7761b0..de1e7ebdd2 100644
--- a/persistence-modules/pom.xml
+++ b/persistence-modules/pom.xml
@@ -102,7 +102,7 @@
spring-data-solr
spring-data-shardingsphere
spring-hibernate-3
-
+ spring-hibernate-5
spring-hibernate-6
spring-jpa
spring-jpa-2
diff --git a/persistence-modules/spring-hibernate-5/pom.xml b/persistence-modules/spring-hibernate-5/pom.xml
index 3ad8f791df..b6c8176f2f 100644
--- a/persistence-modules/spring-hibernate-5/pom.xml
+++ b/persistence-modules/spring-hibernate-5/pom.xml
@@ -125,6 +125,20 @@
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ --add-opens java.base/java.lang=ALL-UNNAMED
+
+
+
+
+
+
5.0.2.RELEASE
@@ -132,7 +146,7 @@
4.2.1.RELEASE
5.6.15.Final
- 5.8.2.Final
+ 5.11.12.Final
8.2.0
9.0.0.M26
1.1
diff --git a/persistence-modules/spring-hibernate-5/src/main/resources/ehcache.xml b/persistence-modules/spring-hibernate-5/src/main/resources/ehcache.xml
new file mode 100644
index 0000000000..6b92162c3c
--- /dev/null
+++ b/persistence-modules/spring-hibernate-5/src/main/resources/ehcache.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/deletion/model/Foo.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/deletion/model/Fooo.java
similarity index 93%
rename from persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/deletion/model/Foo.java
rename to persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/deletion/model/Fooo.java
index f0d57c5b6e..13f5edcfdf 100644
--- a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/deletion/model/Foo.java
+++ b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/deletion/model/Fooo.java
@@ -7,13 +7,13 @@ import javax.persistence.*;
@Entity
@Table(name = "FOO")
@Where(clause = "DELETED = 0")
-public class Foo {
+public class Fooo {
- public Foo() {
+ public Fooo() {
super();
}
- public Foo(final String name) {
+ public Fooo(final String name) {
super();
this.name = name;
}
diff --git a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/service/DeletionIntegrationTest.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/service/DeletionIntegrationTest.java
index dfc944f649..55a287a4e7 100644
--- a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/service/DeletionIntegrationTest.java
+++ b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/persistence/service/DeletionIntegrationTest.java
@@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
import com.baeldung.persistence.deletion.config.PersistenceJPAConfigDeletion;
import com.baeldung.persistence.deletion.model.Bar;
import com.baeldung.persistence.deletion.model.Baz;
-import com.baeldung.persistence.deletion.model.Foo;
+import com.baeldung.persistence.deletion.model.Fooo;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -41,29 +41,29 @@ public class DeletionIntegrationTest {
@Test
@Transactional
public final void givenEntityIsRemoved_thenItIsNotInDB() {
- Foo foo = new Foo("foo");
- entityManager.persist(foo);
+ Fooo fooo = new Fooo("foo");
+ entityManager.persist(fooo);
flushAndClear();
- foo = entityManager.find(Foo.class, foo.getId());
- assertThat(foo, notNullValue());
+ fooo = entityManager.find(Fooo.class, fooo.getId());
+ assertThat(fooo, notNullValue());
- entityManager.remove(foo);
+ entityManager.remove(fooo);
flushAndClear();
- assertThat(entityManager.find(Foo.class, foo.getId()), nullValue());
+ assertThat(entityManager.find(Fooo.class, fooo.getId()), nullValue());
}
@Test
@Transactional
public final void givenEntityIsRemovedAndReferencedByAnotherEntity_thenItIsNotRemoved() {
Bar bar = new Bar("bar");
- Foo foo = new Foo("foo");
- foo.setBar(bar);
- entityManager.persist(foo);
+ Fooo fooo = new Fooo("foo");
+ fooo.setBar(bar);
+ entityManager.persist(fooo);
flushAndClear();
- foo = entityManager.find(Foo.class, foo.getId());
+ fooo = entityManager.find(Fooo.class, fooo.getId());
bar = entityManager.find(Bar.class, bar.getId());
entityManager.remove(bar);
flushAndClear();
@@ -71,8 +71,8 @@ public class DeletionIntegrationTest {
bar = entityManager.find(Bar.class, bar.getId());
assertThat(bar, notNullValue());
- foo = entityManager.find(Foo.class, foo.getId());
- foo.setBar(null);
+ fooo = entityManager.find(Fooo.class, fooo.getId());
+ fooo.setBar(null);
entityManager.remove(bar);
flushAndClear();
@@ -83,16 +83,16 @@ public class DeletionIntegrationTest {
@Transactional
public final void givenEntityIsRemoved_thenRemovalIsCascaded() {
Bar bar = new Bar("bar");
- Foo foo = new Foo("foo");
- foo.setBar(bar);
- entityManager.persist(foo);
+ Fooo fooo = new Fooo("foo");
+ fooo.setBar(bar);
+ entityManager.persist(fooo);
flushAndClear();
- foo = entityManager.find(Foo.class, foo.getId());
- entityManager.remove(foo);
+ fooo = entityManager.find(Fooo.class, fooo.getId());
+ entityManager.remove(fooo);
flushAndClear();
- assertThat(entityManager.find(Foo.class, foo.getId()), nullValue());
+ assertThat(entityManager.find(Fooo.class, fooo.getId()), nullValue());
assertThat(entityManager.find(Bar.class, bar.getId()), nullValue());
}
@@ -116,39 +116,39 @@ public class DeletionIntegrationTest {
@Test
@Transactional
public final void givenEntityIsDeletedWithJpaBulkDeleteStatement_thenItIsNotInDB() {
- Foo foo = new Foo("foo");
- entityManager.persist(foo);
+ Fooo fooo = new Fooo("foo");
+ entityManager.persist(fooo);
flushAndClear();
- entityManager.createQuery("delete from Foo where id = :id").setParameter("id", foo.getId()).executeUpdate();
+ entityManager.createQuery("delete from Foo where id = :id").setParameter("id", fooo.getId()).executeUpdate();
- assertThat(entityManager.find(Foo.class, foo.getId()), nullValue());
+ assertThat(entityManager.find(Fooo.class, fooo.getId()), nullValue());
}
@Test
@Transactional
public final void givenEntityIsDeletedWithNativeQuery_thenItIsNotInDB() {
- Foo foo = new Foo("foo");
- entityManager.persist(foo);
+ Fooo fooo = new Fooo("foo");
+ entityManager.persist(fooo);
flushAndClear();
- entityManager.createNativeQuery("delete from FOO where ID = :id").setParameter("id", foo.getId()).executeUpdate();
+ entityManager.createNativeQuery("delete from FOO where ID = :id").setParameter("id", fooo.getId()).executeUpdate();
- assertThat(entityManager.find(Foo.class, foo.getId()), nullValue());
+ assertThat(entityManager.find(Fooo.class, fooo.getId()), nullValue());
}
@Test
@Transactional
public final void givenEntityIsSoftDeleted_thenItIsNotReturnedFromQueries() {
- Foo foo = new Foo("foo");
- entityManager.persist(foo);
+ Fooo fooo = new Fooo("foo");
+ entityManager.persist(fooo);
flushAndClear();
- foo = entityManager.find(Foo.class, foo.getId());
- foo.setDeleted();
+ fooo = entityManager.find(Fooo.class, fooo.getId());
+ fooo.setDeleted();
flushAndClear();
- assertThat(entityManager.find(Foo.class, foo.getId()), nullValue());
+ assertThat(entityManager.find(Fooo.class, fooo.getId()), nullValue());
}
private void flushAndClear() {