Skip to content

Commit d6a35be

Browse files
committed
Stateless batch test
1 parent e1aff8f commit d6a35be

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

+20
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ public void testBatching(VertxTestContext context) {
145145
);
146146
}
147147

148+
@Test
149+
public void testBatchingWithStateless(VertxTestContext context) {
150+
final GuineaPig[] pigs = {
151+
new GuineaPig( 11, "One" ),
152+
new GuineaPig( 22, "Two" ),
153+
new GuineaPig( 33, "Three" )
154+
};
155+
test( context, getMutinySessionFactory()
156+
.withStatelessTransaction( s -> s.insertAll( 10, pigs ) )
157+
.invoke( () -> {
158+
// We expect only one insert query
159+
assertThat( sqlTracker.getLoggedQueries() ).hasSize( 1 );
160+
// Parameters are different for different dbs, so we cannot do an exact match
161+
assertThat( sqlTracker.getLoggedQueries().get( 0 ) )
162+
.matches("insert into pig \\(name,version,id\\) values (.*)" );
163+
sqlTracker.clear();
164+
} )
165+
);
166+
}
167+
148168
@Test
149169
public void testBatchingConnection(VertxTestContext context) {
150170
test( context, openSession()

0 commit comments

Comments
 (0)