HHH-16316 Move version specific dialects of unsupported versions to hibernate-community-dialects

This commit is contained in:
Christian Beikov 2023-03-15 20:07:19 +01:00
parent b631b0224c
commit 39f4fdda5e
42 changed files with 305 additions and 174 deletions

View File

@ -312,23 +312,6 @@ include::{extrasdir}/entity-inheritance-table-per-class-query-example.sql[]
[IMPORTANT]
====
Polymorphic queries require multiple UNION queries, so be aware of the performance implications of a large class hierarchy.
Unfortunately, not all database systems support UNION ALL, in which case, UNION is going to be used instead of UNION ALL.
The following Hibernate dialects support UNION ALL:
- `AbstractHANADialect`
- `AbstractTransactSQLDialect`
- `CUBRIDDialect`
- `DB2Dialect`
- `H2Dialect`
- `HSQLDialect`
- `Ingres9Dialect`
- `MySQL5Dialect`
- `Oracle8iDialect`
- `Oracle9Dialect`
- `PostgreSQL81Dialect`
- `RDMSOS2200Dialect`
====
[[entity-inheritance-polymorphism]]

View File

@ -20,6 +20,6 @@
LANGUAGE plpgsql;
</create>
<drop></drop>
<dialect-scope name="org.hibernate.dialect.PostgreSQL95Dialect" />
<dialect-scope name="org.hibernate.dialect.PostgreSQLDialect" />
</database-object>
</hibernate-mapping>

View File

@ -20,12 +20,24 @@ public class CommunityDialectSelector implements DialectSelector {
return null;
}
switch ( name ) {
case "DB297":
return DB297Dialect.class;
case "DB2390":
return DB2390Dialect.class;
case "DB2390V8":
return DB2390V8Dialect.class;
case "Cache":
return CacheDialect.class;
case "Cache71":
return Cache71Dialect.class;
case "CUBRID":
return CUBRIDDialect.class;
case "DerbyTenFive":
return DerbyTenFiveDialect.class;
case "DerbyTenSix":
return DerbyTenSixDialect.class;
case "DerbyTenSeven":
return DerbyTenSevenDialect.class;
case "Firebird":
return FirebirdDialect.class;
case "Informix":
@ -38,16 +50,56 @@ public class CommunityDialectSelector implements DialectSelector {
return Ingres9Dialect.class;
case "Ingres10":
return Ingres10Dialect.class;
case "MariaDB53":
return MariaDB53Dialect.class;
case "MariaDB10":
return MariaDB10Dialect.class;
case "MariaDB102":
return MariaDB102Dialect.class;
case "MimerSQL":
return MimerSQLDialect.class;
case "MySQL5":
return MySQL5Dialect.class;
case "MySQL55":
return MySQL55Dialect.class;
case "Oracle8i":
return Oracle8iDialect.class;
case "Oracle9i":
return Oracle9iDialect.class;
case "Oracle10g":
return Oracle10gDialect.class;
case "PostgreSQL81":
return PostgreSQL81Dialect.class;
case "PostgreSQL82":
return PostgreSQL82Dialect.class;
case "PostgreSQL9":
return PostgreSQL9Dialect.class;
case "PostgreSQL91":
return PostgreSQL91Dialect.class;
case "PostgreSQL92":
return PostgreSQL92Dialect.class;
case "PostgreSQL93":
return PostgreSQL93Dialect.class;
case "PostgreSQL94":
return PostgreSQL94Dialect.class;
case "PostgreSQL95":
return PostgreSQL95Dialect.class;
case "RDMSOS2200":
return RDMSOS2200Dialect.class;
case "SAPDB":
return SAPDBDialect.class;
case "SQLServer2005":
return SQLServer2005Dialect.class;
case "MaxDB":
return MaxDBDialect.class;
case "Sybase11":
return Sybase11Dialect.class;
case "SybaseAnywhere":
return SybaseAnywhereDialect.class;
case "SybaseASE15":
return SybaseASE15Dialect.class;
case "SybaseASE157":
return SybaseASE157Dialect.class;
case "Teradata":
return TeradataDialect.class;
case "Teradata14":

View File

@ -4,8 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DB2zDialect;
import org.hibernate.dialect.identity.DB2zIdentityColumnSupport;
import org.hibernate.dialect.identity.IdentityColumnSupport;
import org.hibernate.dialect.pagination.FetchLimitHandler;
@ -24,7 +25,7 @@ import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
* @deprecated Use {@link DB2zDialect}
*/
@Deprecated
public class DB2390Dialect extends DB2Dialect {
public class DB2390Dialect extends DB2LegacyDialect {
private final int version;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
/**

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for DB2 9.7.
@ -13,7 +15,7 @@ package org.hibernate.dialect;
* @deprecated use {@code DB2Dialect(970)}
*/
@Deprecated
public class DB297Dialect extends DB2Dialect {
public class DB297Dialect extends DB2LegacyDialect {
public DB297Dialect() {
super( DatabaseVersion.make( 9, 7 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* Dialect for Derby/Cloudscape 10.5
@ -15,7 +17,7 @@ package org.hibernate.dialect;
* @deprecated use {@code DerbyDialect(1050)}
*/
@Deprecated
public class DerbyTenFiveDialect extends DerbyDialect {
public class DerbyTenFiveDialect extends DerbyLegacyDialect {
public DerbyTenFiveDialect() {
super( DatabaseVersion.make( 10, 5 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* Dialect for Derby 10.7
@ -14,7 +16,7 @@ package org.hibernate.dialect;
* @deprecated use {@code DerbyDialect(1070)}
*/
@Deprecated
public class DerbyTenSevenDialect extends DerbyDialect {
public class DerbyTenSevenDialect extends DerbyLegacyDialect {
public DerbyTenSevenDialect() {
super( DatabaseVersion.make( 10, 7 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* Dialect for Derby/Cloudscape 10.6
@ -15,7 +17,7 @@ package org.hibernate.dialect;
* @deprecated use {@code DerbyDialect(1060)}
*/
@Deprecated
public class DerbyTenSixDialect extends DerbyDialect {
public class DerbyTenSixDialect extends DerbyLegacyDialect {
public DerbyTenSixDialect() {
super( DatabaseVersion.make( 10, 6 ) );

View File

@ -4,13 +4,15 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* @deprecated use {@code MariaDBDialect(1020)}
*/
@Deprecated
public class MariaDB102Dialect extends MariaDBDialect {
public class MariaDB102Dialect extends MariaDBLegacyDialect {
public MariaDB102Dialect() {
super( DatabaseVersion.make( 10, 2 ) );

View File

@ -4,13 +4,15 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* @deprecated use {@code MariaDBDialect(1000)}
*/
@Deprecated
public class MariaDB10Dialect extends MariaDBDialect {
public class MariaDB10Dialect extends MariaDBLegacyDialect {
public MariaDB10Dialect() {
super( DatabaseVersion.make( 10 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* @author Vlad Mihalcea
@ -12,7 +14,7 @@ package org.hibernate.dialect;
* @deprecated use {@code MariaDBDialect(530)}
*/
@Deprecated
public class MariaDB53Dialect extends MariaDBDialect {
public class MariaDB53Dialect extends MariaDBLegacyDialect {
public MariaDB53Dialect() {
super( DatabaseVersion.make( 5, 3 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for MySQL 5.5.x specific features.
@ -14,7 +16,7 @@ package org.hibernate.dialect;
* @deprecated use {@code MySQLDialect(550)}
*/
@Deprecated
public class MySQL55Dialect extends MySQLDialect {
public class MySQL55Dialect extends MySQLLegacyDialect {
public MySQL55Dialect() {
super( DatabaseVersion.make( 5, 5 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for MySQL 5.x specific features.
@ -14,7 +16,7 @@ package org.hibernate.dialect;
* @deprecated use {@code MySQLDialect(500)}
*/
@Deprecated
public class MySQL5Dialect extends MySQLDialect {
public class MySQL5Dialect extends MySQLLegacyDialect {
public MySQL5Dialect() {
super( DatabaseVersion.make( 5 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* A dialect specifically for use with Oracle 10g.
@ -18,7 +20,7 @@ package org.hibernate.dialect;
* @deprecated use {@code OracleDialect(10)}
*/
@Deprecated
public class Oracle10gDialect extends OracleDialect {
public class Oracle10gDialect extends OracleLegacyDialect {
public Oracle10gDialect() {
super( DatabaseVersion.make( 10 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* A dialect for Oracle 8i databases.
@ -12,7 +14,7 @@ package org.hibernate.dialect;
* @deprecated use {@code OracleDialect(8)}
*/
@Deprecated
public class Oracle8iDialect extends OracleDialect {
public class Oracle8iDialect extends OracleLegacyDialect {
public Oracle8iDialect() {
super( DatabaseVersion.make( 8 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* A dialect for Oracle 9i databases.
@ -17,7 +19,7 @@ package org.hibernate.dialect;
* @deprecated use {@code OracleDialect(9)}
*/
@Deprecated
public class Oracle9iDialect extends OracleDialect {
public class Oracle9iDialect extends OracleLegacyDialect {
public Oracle9iDialect() {
super( DatabaseVersion.make( 9 ) );

View File

@ -4,13 +4,15 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* @deprecated use {@code PostgreSQLDialect(810)}
*/
@Deprecated
public class PostgreSQL81Dialect extends PostgreSQLDialect {
public class PostgreSQL81Dialect extends PostgreSQLLegacyDialect {
public PostgreSQL81Dialect() {
super( DatabaseVersion.make( 8, 1 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for Postgres 8.2 and later, adds support for "if exists" when dropping tables
@ -14,7 +16,7 @@ package org.hibernate.dialect;
* @deprecated use {@code PostgreSQLDialect(820)}
*/
@Deprecated
public class PostgreSQL82Dialect extends PostgreSQLDialect {
public class PostgreSQL82Dialect extends PostgreSQLLegacyDialect {
public PostgreSQL82Dialect() {
super( DatabaseVersion.make( 8, 2 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for Postgres 9.1 and later,
@ -15,7 +17,7 @@ package org.hibernate.dialect;
* @deprecated use {@code PostgreSQLDialect(910)}
*/
@Deprecated
public class PostgreSQL91Dialect extends PostgreSQLDialect {
public class PostgreSQL91Dialect extends PostgreSQLLegacyDialect {
public PostgreSQL91Dialect() {
super( DatabaseVersion.make( 9, 1 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for Postgres 9.2 and later,
@ -16,7 +18,7 @@ package org.hibernate.dialect;
* @deprecated use {@code PostgreSQLDialect(920)}
*/
@Deprecated
public class PostgreSQL92Dialect extends PostgreSQLDialect {
public class PostgreSQL92Dialect extends PostgreSQLLegacyDialect {
public PostgreSQL92Dialect() {
super( DatabaseVersion.make( 9, 2 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL Dialect for PostgreSQL 9.3 and later.
@ -15,7 +17,7 @@ package org.hibernate.dialect;
* @deprecated use {@code PostgreSQLDialect(810)}
*/
@Deprecated
public class PostgreSQL93Dialect extends PostgreSQLDialect {
public class PostgreSQL93Dialect extends PostgreSQLLegacyDialect {
public PostgreSQL93Dialect() {
super( DatabaseVersion.make( 9, 3 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for Postgres 9.4 and later.
@ -13,7 +15,7 @@ package org.hibernate.dialect;
* @deprecated use {@code PostgreSQLDialect(940)}
*/
@Deprecated
public class PostgreSQL94Dialect extends PostgreSQLDialect {
public class PostgreSQL94Dialect extends PostgreSQLLegacyDialect {
public PostgreSQL94Dialect() {
super( DatabaseVersion.make( 9, 4 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for Postgres 9.5 and later.
@ -13,7 +15,7 @@ package org.hibernate.dialect;
* @deprecated use {@code PostgreSQLDialect(950)}
*/
@Deprecated
public class PostgreSQL95Dialect extends PostgreSQLDialect {
public class PostgreSQL95Dialect extends PostgreSQLLegacyDialect {
public PostgreSQL95Dialect() {
super( DatabaseVersion.make( 9, 5 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect for Postgres 9 and later.
@ -15,7 +17,7 @@ package org.hibernate.dialect;
* @deprecated use {@code PostgreSQLDialect(900)}
*/
@Deprecated
public class PostgreSQL9Dialect extends PostgreSQLDialect {
public class PostgreSQL9Dialect extends PostgreSQLLegacyDialect {
public PostgreSQL9Dialect() {
super( DatabaseVersion.make( 9 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* A dialect for Microsoft SQL Server 2005.
@ -15,7 +17,7 @@ package org.hibernate.dialect;
* @deprecated use {@code SQLServerDialect(9)}
*/
@Deprecated
public class SQLServer2005Dialect extends SQLServerDialect {
public class SQLServer2005Dialect extends SQLServerLegacyDialect {
public SQLServer2005Dialect() {
super( DatabaseVersion.make( 9 ) );

View File

@ -4,17 +4,19 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* A SQL dialect suitable for use with Sybase 11.9.2
* (specifically: avoids ANSI JOIN syntax)
*
* @author Colm O' Flaherty
* @deprecated use {@link SybaseASEDialect} instead
* @deprecated use {@code SybaseASELegacyDialect( DatabaseVersion.make( 11 ) )}
*/
@Deprecated
public class Sybase11Dialect extends SybaseASEDialect {
public class Sybase11Dialect extends SybaseASELegacyDialect {
public Sybase11Dialect() {
super( DatabaseVersion.make( 11 ) );
}

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect targeting Sybase Adaptive Server Enterprise (ASE) 15.7 and higher.
@ -14,7 +16,7 @@ package org.hibernate.dialect;
* @deprecated use {@code SybaseASEDialect(1570)}
*/
@Deprecated
public class SybaseASE157Dialect extends SybaseASEDialect {
public class SybaseASE157Dialect extends SybaseASELegacyDialect {
public SybaseASE157Dialect() {
super( DatabaseVersion.make( 15, 7 ) );

View File

@ -4,7 +4,9 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.dialect;
package org.hibernate.community.dialect;
import org.hibernate.dialect.DatabaseVersion;
/**
* An SQL dialect targeting Sybase Adaptive Server Enterprise (ASE) 15 and higher.
@ -14,7 +16,7 @@ package org.hibernate.dialect;
* @deprecated use {@code SybaseASEDialect(1500)}
*/
@Deprecated
public class SybaseASE15Dialect extends SybaseASEDialect {
public class SybaseASE15Dialect extends SybaseASELegacyDialect {
public SybaseASE15Dialect() {
super( DatabaseVersion.make( 15 ) );

View File

@ -17,16 +17,53 @@ public class CommunityDialectSelectorTest {
@Test
public void verifyAllDialectNamingResolve() {
testDialectNamingResolution( DB297Dialect.class );
testDialectNamingResolution( DB2390Dialect.class );
testDialectNamingResolution( DB2390V8Dialect.class );
testDialectNamingResolution( Cache71Dialect.class );
testDialectNamingResolution( CUBRIDDialect.class );
testDialectNamingResolution( DerbyTenFiveDialect.class );
testDialectNamingResolution( DerbyTenSixDialect.class );
testDialectNamingResolution( DerbyTenSevenDialect.class );
testDialectNamingResolution( FirebirdDialect.class );
testDialectNamingResolution( InformixDialect.class );
testDialectNamingResolution( IngresDialect.class );
testDialectNamingResolution( Ingres9Dialect.class );
testDialectNamingResolution( Ingres10Dialect.class );
testDialectNamingResolution( MimerSQLDialect.class );
testDialectNamingResolution( MariaDB53Dialect.class );
testDialectNamingResolution( MariaDB10Dialect.class );
testDialectNamingResolution( MariaDB102Dialect.class );
testDialectNamingResolution( MySQL5Dialect.class );
testDialectNamingResolution( MySQL55Dialect.class );
testDialectNamingResolution( Oracle8iDialect.class );
testDialectNamingResolution( Oracle9iDialect.class );
testDialectNamingResolution( Oracle10gDialect.class );
testDialectNamingResolution( PostgreSQL81Dialect.class );
testDialectNamingResolution( PostgreSQL82Dialect.class );
testDialectNamingResolution( PostgreSQL9Dialect.class );
testDialectNamingResolution( PostgreSQL91Dialect.class );
testDialectNamingResolution( PostgreSQL92Dialect.class );
testDialectNamingResolution( PostgreSQL93Dialect.class );
testDialectNamingResolution( PostgreSQL94Dialect.class );
testDialectNamingResolution( PostgreSQL95Dialect.class );
testDialectNamingResolution( SAPDBDialect.class );
testDialectNamingResolution( SQLServer2005Dialect.class );
testDialectNamingResolution( SybaseAnywhereDialect.class );
testDialectNamingResolution( Sybase11Dialect.class );
testDialectNamingResolution( SybaseASE15Dialect.class );
testDialectNamingResolution( SybaseASE157Dialect.class );
testDialectNamingResolution( TeradataDialect.class );
testDialectNamingResolution( TimesTenDialect.class );
}

View File

@ -11,7 +11,6 @@ import java.util.Locale;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.dialect.DatabaseVersion;
import org.hibernate.dialect.SQLServer2005Dialect;
import org.hibernate.query.spi.Limit;
import org.hibernate.testing.TestForIssue;

View File

@ -8,7 +8,6 @@ package org.hibernate.community.dialect.unit.lockhint;
import org.hibernate.community.dialect.SybaseASELegacyDialect;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.orm.test.dialect.unit.lockhint.AbstractLockHintTest;
/**

View File

@ -9,58 +9,35 @@ package org.hibernate.boot.registry.selector.internal;
import java.util.Objects;
import org.hibernate.boot.registry.selector.spi.DialectSelector;
import org.hibernate.boot.registry.selector.spi.StrategySelectionException;
import org.hibernate.dialect.CockroachDialect;
import org.hibernate.dialect.DB2390Dialect;
import org.hibernate.dialect.DB2390V8Dialect;
import org.hibernate.dialect.DB2400Dialect;
import org.hibernate.dialect.DB2400V7R3Dialect;
import org.hibernate.dialect.DB297Dialect;
import org.hibernate.dialect.DB2Dialect;
import org.hibernate.dialect.DB2iDialect;
import org.hibernate.dialect.DB2zDialect;
import org.hibernate.dialect.DerbyDialect;
import org.hibernate.dialect.DerbyTenFiveDialect;
import org.hibernate.dialect.DerbyTenSevenDialect;
import org.hibernate.dialect.DerbyTenSixDialect;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.HANACloudColumnStoreDialect;
import org.hibernate.dialect.HANAColumnStoreDialect;
import org.hibernate.dialect.HANARowStoreDialect;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.MariaDB102Dialect;
import org.hibernate.dialect.MariaDB103Dialect;
import org.hibernate.dialect.MariaDB10Dialect;
import org.hibernate.dialect.MariaDB53Dialect;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQL55Dialect;
import org.hibernate.dialect.MySQL57Dialect;
import org.hibernate.dialect.MySQL5Dialect;
import org.hibernate.dialect.MySQL8Dialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.Oracle10gDialect;
import org.hibernate.dialect.Oracle12cDialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.Oracle9iDialect;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQL82Dialect;
import org.hibernate.dialect.PostgreSQL91Dialect;
import org.hibernate.dialect.PostgreSQL92Dialect;
import org.hibernate.dialect.PostgreSQL93Dialect;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hibernate.dialect.PostgreSQL95Dialect;
import org.hibernate.dialect.PostgreSQL9Dialect;
import org.hibernate.dialect.PostgreSQL10Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.dialect.SQLServer2005Dialect;
import org.hibernate.dialect.SQLServer2008Dialect;
import org.hibernate.dialect.SQLServer2012Dialect;
import org.hibernate.dialect.SQLServer2016Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SpannerDialect;
import org.hibernate.dialect.Sybase11Dialect;
import org.hibernate.dialect.SybaseASE157Dialect;
import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.dialect.SybaseASEDialect;
import org.hibernate.dialect.SybaseDialect;
@ -82,11 +59,10 @@ public class DefaultDialectSelector implements DialectSelector {
case "DB2z":
return DB2zDialect.class;
case "DB297":
return DB297Dialect.class;
return findCommunityDialect( name );
case "DB2390":
return DB2390Dialect.class;
case "DB2390V8":
return DB2390V8Dialect.class;
return findCommunityDialect( name );
case "DB2400":
return DB2400Dialect.class;
case "DB2400V7R3":
@ -94,11 +70,9 @@ public class DefaultDialectSelector implements DialectSelector {
case "Derby":
return DerbyDialect.class;
case "DerbyTenFive":
return DerbyTenFiveDialect.class;
case "DerbyTenSix":
return DerbyTenSixDialect.class;
case "DerbyTenSeven":
return DerbyTenSevenDialect.class;
return findCommunityDialect( name );
case "H2":
return H2Dialect.class;
case "HANACloudColumnStore":
@ -112,19 +86,16 @@ public class DefaultDialectSelector implements DialectSelector {
case "MariaDB":
return MariaDBDialect.class;
case "MariaDB53":
return MariaDB53Dialect.class;
case "MariaDB10":
return MariaDB10Dialect.class;
case "MariaDB102":
return MariaDB102Dialect.class;
return findCommunityDialect( name );
case "MariaDB103":
return MariaDB103Dialect.class;
case "MySQL":
return MySQLDialect.class;
case "MySQL5":
return MySQL5Dialect.class;
case "MySQL55":
return MySQL55Dialect.class;
return findCommunityDialect( name );
case "MySQL57":
return MySQL57Dialect.class;
case "MySQL8":
@ -132,11 +103,9 @@ public class DefaultDialectSelector implements DialectSelector {
case "Oracle":
return OracleDialect.class;
case "Oracle8i":
return Oracle8iDialect.class;
case "Oracle9i":
return Oracle9iDialect.class;
case "Oracle10g":
return Oracle10gDialect.class;
return findCommunityDialect( name );
case "Oracle12c":
return Oracle12cDialect.class;
case "PostgresPlus":
@ -144,43 +113,58 @@ public class DefaultDialectSelector implements DialectSelector {
case "PostgreSQL":
return PostgreSQLDialect.class;
case "PostgreSQL81":
return PostgreSQL81Dialect.class;
case "PostgreSQL82":
return PostgreSQL82Dialect.class;
case "PostgreSQL9":
return PostgreSQL9Dialect.class;
case "PostgreSQL91":
return PostgreSQL91Dialect.class;
case "PostgreSQL92":
return PostgreSQL92Dialect.class;
case "PostgreSQL93":
return PostgreSQL93Dialect.class;
case "PostgreSQL94":
return PostgreSQL94Dialect.class;
case "PostgreSQL95":
return PostgreSQL95Dialect.class;
return findCommunityDialect( name );
case "PostgreSQL10":
return PostgreSQL10Dialect.class;
case "Spanner":
return SpannerDialect.class;
case "SQLServer":
return SQLServerDialect.class;
case "SQLServer2005":
return SQLServer2005Dialect.class;
return findCommunityDialect( name );
case "SQLServer2008":
return SQLServer2008Dialect.class;
case "SQLServer2012":
return SQLServer2012Dialect.class;
case "SQLServer2016":
return SQLServer2016Dialect.class;
case "Sybase":
return SybaseDialect.class;
case "Sybase11":
return Sybase11Dialect.class;
return findCommunityDialect( name );
case "SybaseASE":
return SybaseASEDialect.class;
case "SybaseASE15":
return SybaseASE15Dialect.class;
case "SybaseASE157":
return SybaseASE157Dialect.class;
return findCommunityDialect( name );
}
return null;
}
private static Class<? extends Dialect> findCommunityDialect(String name) {
try {
//noinspection unchecked
return (Class<? extends Dialect>) DefaultDialectSelector.class.getClassLoader().loadClass(
"org.hibernate.community.dialect." + name + "Dialect"
);
}
catch (ClassNotFoundException e) {
throw new StrategySelectionException(
"Couldn't load the dialect class for the `hibernate.dialect` short name [" + name + "], " +
"because the application is missing a dependency on the hibernate-community-dialects module. " +
"Hibernate 6.2 dropped support for database versions that are unsupported by vendors " +
"and code for old versions was moved to the hibernate-community-dialects module. " +
"For further information, read https://in.relation.to/2023/02/15/hibernate-orm-62-db-version-support/",
e
);
}
}
}

View File

@ -278,7 +278,7 @@ import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithN
* passed to the constructor, and by the {@link #getVersion()} property.
* <p>
* Programs using Hibernate should migrate away from the use of versioned
* dialect classes like, for example, {@link PostgreSQL95Dialect}. These
* dialect classes like, for example, {@link MySQL8Dialect}. These
* classes are now deprecated and will be removed in a future release.
* <p>
* A custom {@code Dialect} may be specified using the configuration

View File

@ -861,11 +861,6 @@ public class MySQLDialect extends Dialect {
}
}
@Override
public boolean supportsUnionAll() {
return true;
}
@Override
public SelectItemReferenceStrategy getGroupBySelectItemReferenceStrategy() {
return SelectItemReferenceStrategy.POSITION;

View File

@ -8,6 +8,7 @@ package org.hibernate.engine.jdbc.dialect.internal;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.boot.registry.selector.spi.StrategySelectionException;
@ -33,6 +34,34 @@ import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
*/
public class DialectFactoryImpl implements DialectFactory, ServiceRegistryAwareService {
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( "SQL dialect" );
private static final Set<String> LEGACY_DIALECTS = Set.of(
"org.hibernate.community.dialect.DB297Dialect",
"org.hibernate.community.dialect.DB2390Dialect",
"org.hibernate.community.dialect.DB2390V8Dialect",
"org.hibernate.community.dialect.DerbyTenFiveDialect",
"org.hibernate.community.dialect.DerbyTenSevenDialect",
"org.hibernate.community.dialect.DerbyTenSixDialect",
"org.hibernate.community.dialect.MariaDB10Dialect",
"org.hibernate.community.dialect.MariaDB53Dialect",
"org.hibernate.community.dialect.MariaDB102Dialect",
"org.hibernate.community.dialect.MySQL5Dialect",
"org.hibernate.community.dialect.MySQL55Dialect",
"org.hibernate.community.dialect.Oracle8iDialect",
"org.hibernate.community.dialect.Oracle9iDialect",
"org.hibernate.community.dialect.Oracle10gDialect",
"org.hibernate.community.dialect.PostgreSQL9Dialect",
"org.hibernate.community.dialect.PostgreSQL81Dialect",
"org.hibernate.community.dialect.PostgreSQL82Dialect",
"org.hibernate.community.dialect.PostgreSQL91Dialect",
"org.hibernate.community.dialect.PostgreSQL92Dialect",
"org.hibernate.community.dialect.PostgreSQL93Dialect",
"org.hibernate.community.dialect.PostgreSQL94Dialect",
"org.hibernate.community.dialect.PostgreSQL95Dialect",
"org.hibernate.community.dialect.SQLServer2005Dialect",
"org.hibernate.community.dialect.Sybase11Dialect",
"org.hibernate.community.dialect.SybaseASE15Dialect",
"org.hibernate.community.dialect.SybaseASE157Dialect"
);
private StrategySelector strategySelector;
private DialectResolver dialectResolver;
@ -124,6 +153,20 @@ public class DialectFactoryImpl implements DialectFactory, ServiceRegistryAwareS
}
return dialect;
}
catch (StrategySelectionException e) {
final String dialectFqn = dialectReference.toString();
if ( LEGACY_DIALECTS.contains( dialectFqn ) ) {
throw new StrategySelectionException(
"Couldn't load the dialect class for the `hibernate.dialect` [" + dialectFqn + "], " +
"because the application is missing a dependency on the hibernate-community-dialects module. " +
"Hibernate 6.2 dropped support for database versions that are unsupported by vendors " +
"and code for old versions was moved to the hibernate-community-dialects module. " +
"For further information, read https://in.relation.to/2023/02/15/hibernate-orm-62-db-version-support/",
e
);
}
throw e;
}
catch (HibernateException e) {
throw e;
}

View File

@ -7,6 +7,10 @@
package org.hibernate.orm.test.strategyselectors;
import org.hibernate.boot.registry.selector.internal.DefaultDialectSelector;
import org.hibernate.community.dialect.DerbyTenFiveDialect;
import org.hibernate.community.dialect.DerbyTenSevenDialect;
import org.hibernate.community.dialect.DerbyTenSixDialect;
import org.hibernate.community.dialect.MySQL5Dialect;
import org.hibernate.dialect.*;
import org.junit.jupiter.api.Test;
@ -21,8 +25,6 @@ public class DefaultDialectSelectorTest {
@Test
public void verifyAllDialectNamingResolve() {
testDialectNamingResolution( DB2Dialect.class );
testDialectNamingResolution( DB2390Dialect.class );
testDialectNamingResolution( DB2390V8Dialect.class );
testDialectNamingResolution( DB2400Dialect.class );
testDialectNamingResolution( DB2400V7R3Dialect.class );
@ -42,24 +44,17 @@ public class DefaultDialectSelectorTest {
testDialectNamingResolution( MySQL8Dialect.class );
testDialectNamingResolution( OracleDialect.class );
testDialectNamingResolution( Oracle8iDialect.class );
testDialectNamingResolution( Oracle9iDialect.class );
testDialectNamingResolution( Oracle10gDialect.class );
testDialectNamingResolution( Oracle12cDialect.class );
testDialectNamingResolution( PostgreSQLDialect.class );
testDialectNamingResolution( PostgresPlusDialect.class );
testDialectNamingResolution( PostgreSQL81Dialect.class );
testDialectNamingResolution( PostgreSQL82Dialect.class );
testDialectNamingResolution( PostgreSQL9Dialect.class );
testDialectNamingResolution( PostgreSQL10Dialect.class );
testDialectNamingResolution( SQLServerDialect.class );
testDialectNamingResolution( SQLServer2005Dialect.class );
testDialectNamingResolution( SQLServer2008Dialect.class );
testDialectNamingResolution( SQLServer2012Dialect.class );
testDialectNamingResolution( SybaseDialect.class );
testDialectNamingResolution( Sybase11Dialect.class );
testDialectNamingResolution( SybaseASE15Dialect.class );
testDialectNamingResolution( SybaseASE157Dialect.class );
}
private void testDialectNamingResolution(final Class<?> dialectClass) {

View File

@ -18,10 +18,7 @@ import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.Oracle10gDialect;
import org.hibernate.dialect.Oracle12cDialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.Oracle9iDialect;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.type.BasicType;
@ -42,26 +39,6 @@ import static org.junit.Assert.assertSame;
* @author Steve Ebersole
*/
public class OracleLongLobTypeTest extends BaseUnitTestCase {
@Test
public void testOracle8() {
check( Oracle8iDialect.class, Primitives.class, StandardBasicTypes.BINARY, StandardBasicTypes.CHAR_ARRAY );
check( Oracle8iDialect.class, LobPrimitives.class, StandardBasicTypes.MATERIALIZED_BLOB, StandardBasicTypes.MATERIALIZED_CLOB_CHAR_ARRAY );
check( Oracle8iDialect.class, LobLocators.class, StandardBasicTypes.BLOB, StandardBasicTypes.CLOB );
}
@Test
public void testOracle9() {
check( Oracle9iDialect.class, Primitives.class, StandardBasicTypes.BINARY, StandardBasicTypes.CHAR_ARRAY );
check( Oracle9iDialect.class, LobPrimitives.class, StandardBasicTypes.MATERIALIZED_BLOB, StandardBasicTypes.MATERIALIZED_CLOB_CHAR_ARRAY );
check( Oracle9iDialect.class, LobLocators.class, StandardBasicTypes.BLOB, StandardBasicTypes.CLOB );
}
@Test
public void testOracle10() {
check( Oracle10gDialect.class, Primitives.class, StandardBasicTypes.BINARY, StandardBasicTypes.CHAR_ARRAY );
check( Oracle10gDialect.class, LobPrimitives.class, StandardBasicTypes.MATERIALIZED_BLOB, StandardBasicTypes.MATERIALIZED_CLOB_CHAR_ARRAY );
check( Oracle10gDialect.class, LobLocators.class, StandardBasicTypes.BLOB, StandardBasicTypes.CLOB );
}
@Test
@TestForIssue( jiraKey = "HHH-10345" )

View File

@ -11,7 +11,8 @@ package org.hibernate.spatial.dialect.mysql;
* creation-date: 10/9/13
*/
import org.hibernate.dialect.MySQL55Dialect;
import org.hibernate.dialect.DatabaseVersion;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.spatial.SpatialDialect;
/**
@ -25,6 +26,9 @@ import org.hibernate.spatial.SpatialDialect;
* @deprecated Spatial Dialects are no longer needed
*/
@Deprecated
public class MySQL56SpatialDialect extends MySQL55Dialect implements SpatialDialect {
public class MySQL56SpatialDialect extends MySQLDialect implements SpatialDialect {
public MySQL56SpatialDialect() {
super( DatabaseVersion.make( 5, 5 ) );
}
}

View File

@ -6,7 +6,8 @@
*/
package org.hibernate.spatial.dialect.mysql;
import org.hibernate.dialect.MySQL5Dialect;
import org.hibernate.dialect.DatabaseVersion;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.spatial.SpatialDialect;
/**
@ -16,5 +17,9 @@ import org.hibernate.spatial.SpatialDialect;
* @deprecated Spatial Dialects are no longer needed
*/
@Deprecated
public class MySQL5SpatialDialect extends MySQL5Dialect implements SpatialDialect {
public class MySQL5SpatialDialect extends MySQLDialect implements SpatialDialect {
public MySQL5SpatialDialect() {
super( DatabaseVersion.make( 5 ) );
}
}

View File

@ -7,7 +7,8 @@
package org.hibernate.spatial.dialect.oracle;
import org.hibernate.dialect.Oracle10gDialect;
import org.hibernate.dialect.DatabaseVersion;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.spatial.SpatialDialect;
/**
@ -18,6 +19,10 @@ import org.hibernate.spatial.SpatialDialect;
* @deprecated A SpatialDialect is no longer required. Use the standard Dialect for this database.
*/
@Deprecated
public class OracleSpatial10gDialect extends Oracle10gDialect implements SpatialDialect {
public class OracleSpatial10gDialect extends OracleDialect implements SpatialDialect {
public OracleSpatial10gDialect() {
super( DatabaseVersion.make( 10 ) );
}
}

View File

@ -6,7 +6,8 @@
*/
package org.hibernate.spatial.dialect.oracle;
import org.hibernate.dialect.Oracle10gDialect;
import org.hibernate.dialect.DatabaseVersion;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.spatial.SpatialDialect;
/**
@ -15,6 +16,9 @@ import org.hibernate.spatial.SpatialDialect;
* @deprecated A SpatialDialect is no longer required. Use the standard Dialect for this database.
*/
@Deprecated
public class OracleSpatialSDO10gDialect extends Oracle10gDialect
implements SpatialDialect {
public class OracleSpatialSDO10gDialect extends OracleDialect implements SpatialDialect {
public OracleSpatialSDO10gDialect() {
super( DatabaseVersion.make( 10 ) );
}
}