Skip to content

Commit 5e71abb

Browse files
geoandDavideD
authored andcommitted
Work around lazy eager loading issue in clean DB for EagerOneToManyAssociationTest
1 parent 702fdf1 commit 5e71abb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hibernate-reactive-core/src/test/java/org/hibernate/reactive/EagerOneToManyAssociationTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
package org.hibernate.reactive;
77

8+
import org.junit.After;
89
import org.junit.Test;
910

1011
import jakarta.persistence.*;
@@ -25,6 +26,13 @@ protected Collection<Class<?>> annotatedEntities() {
2526
return List.of( Author.class, Book.class );
2627
}
2728

29+
@After
30+
public void cleanDb(TestContext context) {
31+
test( context, getSessionFactory()
32+
.withTransaction( s -> s.createQuery( "delete from Author" ).executeUpdate()
33+
.thenCompose( v -> s.createQuery( "delete from Book" ).executeUpdate() ) ) );
34+
}
35+
2836
@Test
2937
public void findBookWithAuthors(TestContext context) {
3038
final Book goodOmens = new Book( 7242353, "Good Omens: The Nice and Accurate Prophecies of Agnes Nutter, Witch" );

0 commit comments

Comments
 (0)