From cac22a3926ddbdc0ee42f98c93ebd54ef6fd6903 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 31 Oct 2012 12:41:48 -0500 Subject: [PATCH] HHH-7725 - Make handling multi-table bulk HQL operations more pluggable (cherry picked from commit 1b5088a911c60584d2690014c924c6c3c9a20fcc) --- .../hql/spi/AbstractTableBasedBulkIdHandler.java | 4 ---- .../hql/spi/PersistentTableBulkIdStrategy.java | 4 ++-- .../hql/spi/TableBasedDeleteHandlerImpl.java | 12 ++++++++++-- .../hql/spi/TableBasedUpdateHandlerImpl.java | 12 ++++++++++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/hql/spi/AbstractTableBasedBulkIdHandler.java b/hibernate-core/src/main/java/org/hibernate/hql/spi/AbstractTableBasedBulkIdHandler.java index c7c1061b31..11d2793306 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/spi/AbstractTableBasedBulkIdHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/spi/AbstractTableBasedBulkIdHandler.java @@ -55,10 +55,6 @@ public class AbstractTableBasedBulkIdHandler { private final String catalog; private final String schema; - public AbstractTableBasedBulkIdHandler(SessionFactoryImplementor sessionFactory, HqlSqlWalker walker) { - this( sessionFactory, walker, null, null ); - } - public AbstractTableBasedBulkIdHandler( SessionFactoryImplementor sessionFactory, HqlSqlWalker walker, diff --git a/hibernate-core/src/main/java/org/hibernate/hql/spi/PersistentTableBulkIdStrategy.java b/hibernate-core/src/main/java/org/hibernate/hql/spi/PersistentTableBulkIdStrategy.java index 1a58867b9b..eb286f9f8d 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/spi/PersistentTableBulkIdStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/spi/PersistentTableBulkIdStrategy.java @@ -217,7 +217,7 @@ public class PersistentTableBulkIdStrategy implements MultiTableBulkIdStrategy { @Override public UpdateHandler buildUpdateHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) { - return new TableBasedUpdateHandlerImpl( factory, walker ) { + return new TableBasedUpdateHandlerImpl( factory, walker, catalog, schema ) { @Override protected void addAnyExtraIdSelectValues(SelectValues selectClause) { selectClause.addParameter( Types.CHAR, 36 ); @@ -285,7 +285,7 @@ public class PersistentTableBulkIdStrategy implements MultiTableBulkIdStrategy { @Override public DeleteHandler buildDeleteHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) { - return new TableBasedDeleteHandlerImpl( factory, walker ) { + return new TableBasedDeleteHandlerImpl( factory, walker, catalog, schema ) { @Override protected void addAnyExtraIdSelectValues(SelectValues selectClause) { selectClause.addParameter( Types.CHAR, 36 ); diff --git a/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedDeleteHandlerImpl.java b/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedDeleteHandlerImpl.java index 0e203ce152..8b51d537b3 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedDeleteHandlerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedDeleteHandlerImpl.java @@ -54,8 +54,16 @@ public class TableBasedDeleteHandlerImpl private final List idSelectParameterSpecifications; private final String[] deletes; - TableBasedDeleteHandlerImpl(SessionFactoryImplementor factory, HqlSqlWalker walker) { - super( factory, walker ); + public TableBasedDeleteHandlerImpl(SessionFactoryImplementor factory, HqlSqlWalker walker) { + this( factory, walker, null, null ); + } + + public TableBasedDeleteHandlerImpl( + SessionFactoryImplementor factory, + HqlSqlWalker walker, + String catalog, + String schema) { + super( factory, walker, catalog, schema ); DeleteStatement deleteStatement = ( DeleteStatement ) walker.getAST(); FromElement fromElement = deleteStatement.getFromClause().getFromElement(); diff --git a/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedUpdateHandlerImpl.java b/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedUpdateHandlerImpl.java index fd5cb8b4ae..5b2a990213 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedUpdateHandlerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedUpdateHandlerImpl.java @@ -60,8 +60,16 @@ public class TableBasedUpdateHandlerImpl private final ParameterSpecification[][] assignmentParameterSpecifications; @SuppressWarnings("unchecked") - TableBasedUpdateHandlerImpl(SessionFactoryImplementor factory, HqlSqlWalker walker) { - super( factory, walker ); + public TableBasedUpdateHandlerImpl(SessionFactoryImplementor factory, HqlSqlWalker walker) { + this( factory, walker, null, null ); + } + + public TableBasedUpdateHandlerImpl( + SessionFactoryImplementor factory, + HqlSqlWalker walker, + String catalog, + String schema) { + super( factory, walker, catalog, schema ); UpdateStatement updateStatement = ( UpdateStatement ) walker.getAST(); FromElement fromElement = updateStatement.getFromClause().getFromElement();