From 8f5c7881ff08feabd4157984d5b8b36567ba9f4b Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Mon, 23 May 2022 17:50:26 +0200 Subject: [PATCH] HHH-15281 INSERTs/UPDATEs no longer executed as JDBC Batch statements if hibernate.temp.use_jdbc_metadata_defaults is set to false --- .../jdbc/env/internal/ExtractedDatabaseMetaDataImpl.java | 3 ++- .../hibernate/orm/test/jdbc/env/NoDatabaseMetaDataTest.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/ExtractedDatabaseMetaDataImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/ExtractedDatabaseMetaDataImpl.java index abf1aa0e97..98b4ce60fc 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/ExtractedDatabaseMetaDataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/ExtractedDatabaseMetaDataImpl.java @@ -169,7 +169,8 @@ public class ExtractedDatabaseMetaDataImpl implements ExtractedDatabaseMetaData private boolean supportsNamedParameters; private boolean supportsScrollableResults; private boolean supportsGetGeneratedKeys; - private boolean supportsBatchUpdates; + // In absence of DatabaseMetaData batching updates is assumed to be supported + private boolean supportsBatchUpdates = true; private boolean supportsDataDefinitionInTransaction; private boolean doesDataDefinitionCauseTransactionCommit; private SQLStateType sqlStateType; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/env/NoDatabaseMetaDataTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/env/NoDatabaseMetaDataTest.java index ed707f157a..28037c0c93 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/env/NoDatabaseMetaDataTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/env/NoDatabaseMetaDataTest.java @@ -44,7 +44,7 @@ public class NoDatabaseMetaDataTest extends BaseUnitTestCase { assertFalse( extractedDatabaseMetaData.supportsRefCursors() ); assertFalse( extractedDatabaseMetaData.supportsScrollableResults() ); assertFalse( extractedDatabaseMetaData.supportsGetGeneratedKeys() ); - assertFalse( extractedDatabaseMetaData.supportsBatchUpdates() ); + assertTrue( extractedDatabaseMetaData.supportsBatchUpdates() ); assertFalse( extractedDatabaseMetaData.supportsDataDefinitionInTransaction() ); assertFalse( extractedDatabaseMetaData.doesDataDefinitionCauseTransactionCommit() ); assertNull( extractedDatabaseMetaData.getSqlStateType() ); @@ -68,7 +68,7 @@ public class NoDatabaseMetaDataTest extends BaseUnitTestCase { assertFalse( extractedDatabaseMetaData.supportsRefCursors() ); assertFalse( extractedDatabaseMetaData.supportsScrollableResults() ); assertFalse( extractedDatabaseMetaData.supportsGetGeneratedKeys() ); - assertFalse( extractedDatabaseMetaData.supportsBatchUpdates() ); + assertTrue( extractedDatabaseMetaData.supportsBatchUpdates() ); assertFalse( extractedDatabaseMetaData.supportsDataDefinitionInTransaction() ); assertFalse( extractedDatabaseMetaData.doesDataDefinitionCauseTransactionCommit() ); assertNull( extractedDatabaseMetaData.getSqlStateType() );