From 30dba20ce4912cef21b3e822a62dd7a025c908dc Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Fri, 23 Oct 2009 05:08:40 +0000 Subject: [PATCH] HHH-4442 - Change StandardDialectResolver to use SybaseASE15Dialect over deprecated SybaseDialect git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17823 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../hibernate/dialect/SybaseASE15Dialect.java | 42 +++++++++---------- .../dialect/SybaseAnywhereDialect.java | 17 ++++---- .../org/hibernate/dialect/SybaseDialect.java | 6 ++- .../resolver/StandardDialectResolver.java | 4 +- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java b/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java index 8b1b0c8a04..653d5a7c27 100644 --- a/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java +++ b/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java @@ -1,11 +1,10 @@ -//$Id $ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by + * third-party contributors as indicated by either @author tags or express + * copyright attribution statements applied by the authors. All + * third-party contributions are distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -21,32 +20,22 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.dialect; -import java.sql.CallableStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.sql.Types; -import java.util.Map; -import java.util.Iterator; import org.hibernate.Hibernate; -import org.hibernate.LockMode; -import org.hibernate.cfg.Environment; import org.hibernate.dialect.function.AnsiTrimEmulationFunction; -import org.hibernate.dialect.function.CharIndexFunction; -import org.hibernate.dialect.function.NoArgSQLFunction; import org.hibernate.dialect.function.SQLFunctionTemplate; -import org.hibernate.dialect.function.StandardSQLFunction; -import org.hibernate.dialect.function.VarArgsSQLFunction; /** - * An SQL dialect compatible with Sybase and MS SQL Server. + * An SQL dialect targetting Sybase Adaptive Server Enterprise (ASE) 15 and higher. + *

+ * TODO : verify if this also works with 12/12.5 + * * @author Gavin King */ - public class SybaseASE15Dialect extends AbstractTransactSQLDialect { public SybaseASE15Dialect() { super(); @@ -68,13 +57,22 @@ public class SybaseASE15Dialect extends AbstractTransactSQLDialect { public boolean supportsCascadeDelete() { return false; } + /** - * By default, Sybase string comparisons are case-insensitive.
- * If the DB is configured to be case-sensitive, then the return value will be incorrect. + * By default, Sybase string comparisons are case-insensitive. + *

+ * If the DB is configured to be case-sensitive, then this return + * value will be incorrect. */ public boolean areStringComparisonsCaseInsensitive() { return true; - } + } + + /** + * Actually Sybase does not support LOB locators at al. + * + * @return false. + */ public boolean supportsExpectedLobUsagePattern() { return false; } diff --git a/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java b/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java index 0aa84ae067..3e706dcb65 100644 --- a/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java +++ b/core/src/main/java/org/hibernate/dialect/SybaseAnywhereDialect.java @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by + * third-party contributors as indicated by either @author tags or express + * copyright attribution statements applied by the authors. All + * third-party contributions are distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -20,7 +20,6 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.dialect; @@ -31,7 +30,6 @@ package org.hibernate.dialect; * @author ? */ public class SybaseAnywhereDialect extends AbstractTransactSQLDialect { - /** * Sybase Anywhere syntax would require a "DEFAULT" for each column specified, * but I suppose Hibernate use this syntax only with tables with just 1 column @@ -40,10 +38,11 @@ public class SybaseAnywhereDialect extends AbstractTransactSQLDialect { return "values (default)"; } - /** - * ASA does not require to drop constraint before dropping tables, and DROP statement - * syntax used by Hibernate to drop constraint is not compatible with ASA, so disable it + * ASA does not require to drop constraint before dropping tables, so disable it. + *

+ * NOTE : Also, the DROP statement syntax used by Hibernate to drop constraints is + * not compatible with ASA. */ public boolean dropConstraints() { return false; diff --git a/core/src/main/java/org/hibernate/dialect/SybaseDialect.java b/core/src/main/java/org/hibernate/dialect/SybaseDialect.java index e53f0da22c..d44d0aba9d 100644 --- a/core/src/main/java/org/hibernate/dialect/SybaseDialect.java +++ b/core/src/main/java/org/hibernate/dialect/SybaseDialect.java @@ -31,9 +31,11 @@ package org.hibernate.dialect; * Sybase. Those functions have now been split. * {@link AbstractTransactSQLDialect} should be used as the base class for * TransactSQL-based dialects. - * + * * @author Gail Badner - * @deprecated use {@link SybaseASE15Dialect} or {@link SQLServerDialect} instead. + * @deprecated use {@link AbstractTransactSQLDialect}, + * {@link SybaseASE15Dialect} or {@link SQLServerDialect} instead depending on + * need. */ public class SybaseDialect extends AbstractTransactSQLDialect { } diff --git a/core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java b/core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java index 4fa97b1ed1..e809e3b28c 100644 --- a/core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java +++ b/core/src/main/java/org/hibernate/dialect/resolver/StandardDialectResolver.java @@ -37,13 +37,13 @@ import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.dialect.DerbyDialect; import org.hibernate.dialect.IngresDialect; import org.hibernate.dialect.SQLServerDialect; -import org.hibernate.dialect.SybaseDialect; import org.hibernate.dialect.InformixDialect; import org.hibernate.dialect.DB2Dialect; import org.hibernate.dialect.Oracle10gDialect; import org.hibernate.dialect.Oracle9iDialect; import org.hibernate.dialect.Oracle8iDialect; import org.hibernate.dialect.SybaseAnywhereDialect; +import org.hibernate.dialect.SybaseASE15Dialect; /** * The standard Hibernate resolver. @@ -86,7 +86,7 @@ public class StandardDialectResolver extends AbstractDialectResolver{ } if ( "Sybase SQL Server".equals( databaseName ) || "Adaptive Server Enterprise".equals( databaseName ) ) { - return new SybaseDialect(); + return new SybaseASE15Dialect(); } if ( databaseName.startsWith( "Adaptive Server Anywhere" ) ) {