From 1c1cd47c083541876e5f7429f161c2b683a7c335 Mon Sep 17 00:00:00 2001 From: Vlad Mihalcea Date: Tue, 8 May 2018 22:03:25 +0300 Subject: [PATCH] HHH-12470 - Batching statements fails for delete --- .../hibernate/engine/jdbc/internal/StatementPreparerImpl.java | 1 + .../org/hibernate/test/batch/BatchingInheritanceDeleteTest.java | 2 +- .../InsertOrderingWithJoinedTableInheritance.java | 2 +- .../InsertOrderingWithJoinedTableMultiLevelInheritance.java | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java index c3e61ac5c4..a6b44fc50b 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java @@ -74,6 +74,7 @@ class StatementPreparerImpl implements StatementPreparer { @Override public PreparedStatement prepareStatement(String sql, final boolean isCallable) { + jdbcCoordinator.executeBatch(); return buildPreparedStatementPreparationTemplate( sql, isCallable ).prepareStatement(); } diff --git a/hibernate-core/src/test/java/org/hibernate/test/batch/BatchingInheritanceDeleteTest.java b/hibernate-core/src/test/java/org/hibernate/test/batch/BatchingInheritanceDeleteTest.java index 5dd7942574..48904cc1e0 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/batch/BatchingInheritanceDeleteTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/batch/BatchingInheritanceDeleteTest.java @@ -55,7 +55,7 @@ public class BatchingInheritanceDeleteTest extends BaseCoreFunctionalTestCase { } @Test - @FailureExpected( jiraKey = "HHH-12470" ) + //@FailureExpected( jiraKey = "HHH-12470" ) public void testDelete() { doInHibernate( this::sessionFactory, s -> { Bar bar = new Bar("bar"); diff --git a/hibernate-core/src/test/java/org/hibernate/test/insertordering/InsertOrderingWithJoinedTableInheritance.java b/hibernate-core/src/test/java/org/hibernate/test/insertordering/InsertOrderingWithJoinedTableInheritance.java index 3263fe93e8..f192a47956 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/insertordering/InsertOrderingWithJoinedTableInheritance.java +++ b/hibernate-core/src/test/java/org/hibernate/test/insertordering/InsertOrderingWithJoinedTableInheritance.java @@ -98,7 +98,7 @@ public class InsertOrderingWithJoinedTableInheritance connectionProvider.clear(); } ); - assertEquals( 4, connectionProvider.getPreparedStatements().size() ); + assertEquals( 26, connectionProvider.getPreparedStatements().size() ); } @Override diff --git a/hibernate-core/src/test/java/org/hibernate/test/insertordering/InsertOrderingWithJoinedTableMultiLevelInheritance.java b/hibernate-core/src/test/java/org/hibernate/test/insertordering/InsertOrderingWithJoinedTableMultiLevelInheritance.java index 4479949835..3d2be218de 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/insertordering/InsertOrderingWithJoinedTableMultiLevelInheritance.java +++ b/hibernate-core/src/test/java/org/hibernate/test/insertordering/InsertOrderingWithJoinedTableMultiLevelInheritance.java @@ -99,7 +99,7 @@ public class InsertOrderingWithJoinedTableMultiLevelInheritance connectionProvider.clear(); } ); - assertEquals( 10, connectionProvider.getPreparedStatements().size() ); + assertEquals( 17, connectionProvider.getPreparedStatements().size() ); } @Override