14
14
import org .hibernate .annotations .FetchMode ;
15
15
16
16
import org .junit .jupiter .api .AfterEach ;
17
- import org .junit .jupiter .api .Disabled ;
18
17
import org .junit .jupiter .api .Test ;
19
18
20
19
import io .vertx .junit5 .Timeout ;
43
42
import static org .junit .jupiter .api .Assertions .assertFalse ;
44
43
import static org .junit .jupiter .api .Assertions .assertTrue ;
45
44
46
- @ Disabled // see https://github.com/hibernate/hibernate-reactive/issues/1502
47
45
@ Timeout (value = 10 , timeUnit = MINUTES )
48
46
public class SubselectFetchTest extends BaseReactiveTest {
49
47
@@ -59,6 +57,10 @@ public void cleanDb(VertxTestContext context) {
59
57
.thenCompose ( v -> s .createQuery ( "delete from Node" ).executeUpdate () ) ) );
60
58
}
61
59
60
+ /**
61
+ * @see org.hibernate.orm.test.mapping.fetch.subselect.SubselectFetchTest#testSubselectFetchHql()
62
+ * @param context
63
+ */
62
64
@ Test
63
65
public void testQuery (VertxTestContext context ) {
64
66
Node basik = new Node ( "Child" );
@@ -80,6 +82,11 @@ public void testQuery(VertxTestContext context) {
80
82
Node n2 = list .get ( 1 );
81
83
assertFalse ( isInitialized ( n1 .getElements () ), "'n1.elements' should not be initialized" );
82
84
assertFalse ( isInitialized ( n2 .getElements () ), "'n2.elements' should not be initialized" );
85
+
86
+ // .size() triggers loading of elements
87
+ assertTrue ( n1 .getElements ().size () == 3 );
88
+ assertTrue ( n2 .getElements ().size () == 2 );
89
+
83
90
return s .fetch ( n1 .getElements () ).thenAccept ( elements -> {
84
91
assertTrue ( isInitialized ( elements ), "'elements' - after fetch - should be initialized" );
85
92
assertTrue ( isInitialized ( n1 .getElements () ), "'n1.elements' - after fetch - should be initialized" );
0 commit comments