From fe1b141f79db717937da137b1eda33d35bf8b704 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 24 Sep 2015 16:20:03 +0100 Subject: [PATCH] HHH-10150 - Override PostgreSQL9Dialect#getDefaultMultiTableBulkIdStrategy() causing exception in deleting joined subclasses --- .../hibernate/dialect/PostgreSQL9Dialect.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL9Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL9Dialect.java index eee57f43db..2aed4b61bd 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL9Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL9Dialect.java @@ -6,6 +6,11 @@ */ package org.hibernate.dialect; +import org.hibernate.hql.spi.id.IdTableSupportStandardImpl; +import org.hibernate.hql.spi.id.MultiTableBulkIdStrategy; +import org.hibernate.hql.spi.id.local.AfterUseAction; +import org.hibernate.hql.spi.id.local.LocalTemporaryTableBulkIdStrategy; + /** * An SQL dialect for Postgres 9 and later. Adds support for "if exists" when dropping constraints * @@ -16,4 +21,23 @@ public class PostgreSQL9Dialect extends PostgreSQL82Dialect { public boolean supportsIfExistsBeforeConstraintName() { return true; } + + @Override + public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy() { + return new LocalTemporaryTableBulkIdStrategy( + new IdTableSupportStandardImpl() { + @Override + public String getCreateIdTableCommand() { + return "create temporary table"; + } + + @Override + public String getDropIdTableCommand() { + return "drop table"; + } + }, + AfterUseAction.DROP, + null + ); + } }