|
23 | 23 | import org.hibernate.reactive.testing.DatabaseSelectionRule;
|
24 | 24 | import org.hibernate.reactive.testing.SqlStatementTracker;
|
25 | 25 |
|
| 26 | +import org.junit.After; |
26 | 27 | import org.junit.Rule;
|
27 | 28 | import org.junit.Test;
|
28 | 29 |
|
@@ -53,6 +54,13 @@ protected Configuration constructConfiguration() {
|
53 | 54 | return configuration;
|
54 | 55 | }
|
55 | 56 |
|
| 57 | + @After |
| 58 | + public void cleanDb(TestContext context) { |
| 59 | + test( context, getSessionFactory() |
| 60 | + .withTransaction( s -> s.createQuery( "delete from Child" ).executeUpdate() |
| 61 | + .thenCompose( v -> s.createQuery( "delete from Parent" ).executeUpdate() ) ) ); |
| 62 | + } |
| 63 | + |
56 | 64 | private static boolean isSelectOrInsertQuery(String s) {
|
57 | 65 | return s.toLowerCase().startsWith( "select" )
|
58 | 66 | || s.toLowerCase().startsWith( "insert" );
|
@@ -92,11 +100,11 @@ public void testWithMutiny(TestContext context) {
|
92 | 100 | // We don't expect a select from CHILD
|
93 | 101 | private String[] getExpectedNativeQueries() {
|
94 | 102 | return new String[] {
|
95 |
| - "select nextval ('hibernate_sequence')", |
96 |
| - "insert into PARENT (name, id) values ($1, $2)", |
97 |
| - "select fetchedass0_.id as id1_1_, fetchedass0_.name as name2_1_ from PARENT fetchedass0_", |
98 |
| - "select nextval ('hibernate_sequence')", |
99 |
| - "insert into CHILD (name, lazy_parent_id, id) values ($1, $2, $3)" |
| 103 | + "select nextval('PARENT_SEQ')", |
| 104 | + "insert into PARENT (name,id) values ($1,$2)", |
| 105 | + "select p1_0.id,p1_0.name from PARENT p1_0", |
| 106 | + "select nextval('CHILD_SEQ')", |
| 107 | + "insert into CHILD (name,lazy_parent_id,id) values ($1,$2,$3)" |
100 | 108 | };
|
101 | 109 | }
|
102 | 110 |
|
|
0 commit comments