Skip to content

Commit aa2c177

Browse files
DavideDdreab8
authored andcommitted
[#2108] Add test for StatelessSession insertAll in batch does not do batching
1 parent 0e99eb7 commit aa2c177

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: hibernate-reactive-core/src/test/java/org/hibernate/reactive/BatchingConnectionTest.java

+23
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,29 @@ 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+
new GuineaPig( 44, "Four" ),
155+
new GuineaPig( 55, "Five" ),
156+
new GuineaPig( 66, "Six" ),
157+
};
158+
test( context, getMutinySessionFactory()
159+
.withStatelessTransaction( s -> s.insertAll( 10, pigs ) )
160+
.invoke( () -> {
161+
// We expect only one insert query
162+
assertThat( sqlTracker.getLoggedQueries() ).hasSize( 1 );
163+
// Parameters are different for different dbs, so we cannot do an exact match
164+
assertThat( sqlTracker.getLoggedQueries().get( 0 ) )
165+
.matches("insert into pig \\(name,version,id\\) values (.*)" );
166+
sqlTracker.clear();
167+
} )
168+
);
169+
}
170+
148171
@Test
149172
public void testBatchingConnection(VertxTestContext context) {
150173
test( context, openSession()

0 commit comments

Comments
 (0)