Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ private ReactiveStatelessSessionImpl(
PersistenceContext persistenceContext) {
super( factory, options );
this.persistenceContext = persistenceContext;
// StatelessSessionImpl constructor sets the Jdbc Batch Size to 0,
// setting it to null allows getConfiguredJdbcBatchSize() to return correct configured size
setJdbcBatchSize( null );
Integer batchSize = getConfiguredJdbcBatchSize();
reactiveConnection = batchSize == null || batchSize < 2
? connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,29 @@ public void testBatching(VertxTestContext context) {
);
}

@Test
public void testBatchingWithStateless(VertxTestContext context) {
final GuineaPig[] pigs = {
new GuineaPig( 11, "One" ),
new GuineaPig( 22, "Two" ),
new GuineaPig( 33, "Three" ),
new GuineaPig( 44, "Four" ),
new GuineaPig( 55, "Five" ),
new GuineaPig( 66, "Six" ),
};
test( context, getMutinySessionFactory()
.withStatelessTransaction( s -> s.insertAll( 10, pigs ) )
.invoke( () -> {
// We expect only one insert query
assertThat( sqlTracker.getLoggedQueries() ).hasSize( 1 );
// Parameters are different for different dbs, so we cannot do an exact match
assertThat( sqlTracker.getLoggedQueries().get( 0 ) )
.matches("insert into pig \\(name,version,id\\) values (.*)" );
sqlTracker.clear();
} )
);
}

@Test
public void testBatchingConnection(VertxTestContext context) {
test( context, openSession()
Expand Down
Loading