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
This commit is contained in:
Steve Ebersole 2009-10-23 05:08:40 +00:00
parent 9e76e1b184
commit 30dba20ce4
4 changed files with 34 additions and 35 deletions

View File

@ -1,11 +1,10 @@
//$Id $
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by
* indicated by the @author tags or express copyright attribution * third-party contributors as indicated by either @author tags or express
* statements applied by the authors. All third-party contributions are * copyright attribution statements applied by the authors. All
* distributed under license by Red Hat Middleware LLC. * third-party contributions are distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * 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 * copy, or redistribute it subject to the terms and conditions of the GNU
@ -21,32 +20,22 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.dialect; package org.hibernate.dialect;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types; import java.sql.Types;
import java.util.Map;
import java.util.Iterator;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction; 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.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.
* <p/>
* TODO : verify if this also works with 12/12.5
*
* @author Gavin King * @author Gavin King
*/ */
public class SybaseASE15Dialect extends AbstractTransactSQLDialect { public class SybaseASE15Dialect extends AbstractTransactSQLDialect {
public SybaseASE15Dialect() { public SybaseASE15Dialect() {
super(); super();
@ -68,13 +57,22 @@ public class SybaseASE15Dialect extends AbstractTransactSQLDialect {
public boolean supportsCascadeDelete() { public boolean supportsCascadeDelete() {
return false; return false;
} }
/** /**
* By default, Sybase string comparisons are case-insensitive.<br> * By default, Sybase string comparisons are case-insensitive.
* If the DB is configured to be case-sensitive, then the return value will be incorrect. * <p/>
* If the DB is configured to be case-sensitive, then this return
* value will be incorrect.
*/ */
public boolean areStringComparisonsCaseInsensitive() { public boolean areStringComparisonsCaseInsensitive() {
return true; return true;
} }
/**
* Actually Sybase does not support LOB locators at al.
*
* @return false.
*/
public boolean supportsExpectedLobUsagePattern() { public boolean supportsExpectedLobUsagePattern() {
return false; return false;
} }

View File

@ -1,10 +1,10 @@
/* /*
* Hibernate, Relational Persistence for Idiomatic Java * Hibernate, Relational Persistence for Idiomatic Java
* *
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by
* indicated by the @author tags or express copyright attribution * third-party contributors as indicated by either @author tags or express
* statements applied by the authors. All third-party contributions are * copyright attribution statements applied by the authors. All
* distributed under license by Red Hat Middleware LLC. * third-party contributions are distributed under license by Red Hat Inc.
* *
* This copyrighted material is made available to anyone wishing to use, modify, * 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 * copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc. * Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*
*/ */
package org.hibernate.dialect; package org.hibernate.dialect;
@ -31,7 +30,6 @@ package org.hibernate.dialect;
* @author ? * @author ?
*/ */
public class SybaseAnywhereDialect extends AbstractTransactSQLDialect { public class SybaseAnywhereDialect extends AbstractTransactSQLDialect {
/** /**
* Sybase Anywhere syntax would require a "DEFAULT" for each column specified, * 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 * 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)"; return "values (default)";
} }
/** /**
* ASA does not require to drop constraint before dropping tables, and DROP statement * ASA does not require to drop constraint before dropping tables, so disable it.
* syntax used by Hibernate to drop constraint is not compatible with ASA, so disable it * <p/>
* NOTE : Also, the DROP statement syntax used by Hibernate to drop constraints is
* not compatible with ASA.
*/ */
public boolean dropConstraints() { public boolean dropConstraints() {
return false; return false;

View File

@ -31,9 +31,11 @@ package org.hibernate.dialect;
* Sybase. Those functions have now been split. * Sybase. Those functions have now been split.
* {@link AbstractTransactSQLDialect} should be used as the base class for * {@link AbstractTransactSQLDialect} should be used as the base class for
* TransactSQL-based dialects. * TransactSQL-based dialects.
* *
* @author Gail Badner * @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 { public class SybaseDialect extends AbstractTransactSQLDialect {
} }

View File

@ -37,13 +37,13 @@ import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.DerbyDialect; import org.hibernate.dialect.DerbyDialect;
import org.hibernate.dialect.IngresDialect; import org.hibernate.dialect.IngresDialect;
import org.hibernate.dialect.SQLServerDialect; import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.InformixDialect; import org.hibernate.dialect.InformixDialect;
import org.hibernate.dialect.DB2Dialect; import org.hibernate.dialect.DB2Dialect;
import org.hibernate.dialect.Oracle10gDialect; import org.hibernate.dialect.Oracle10gDialect;
import org.hibernate.dialect.Oracle9iDialect; import org.hibernate.dialect.Oracle9iDialect;
import org.hibernate.dialect.Oracle8iDialect; import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.SybaseAnywhereDialect; import org.hibernate.dialect.SybaseAnywhereDialect;
import org.hibernate.dialect.SybaseASE15Dialect;
/** /**
* The standard Hibernate resolver. * The standard Hibernate resolver.
@ -86,7 +86,7 @@ public class StandardDialectResolver extends AbstractDialectResolver{
} }
if ( "Sybase SQL Server".equals( databaseName ) || "Adaptive Server Enterprise".equals( databaseName ) ) { if ( "Sybase SQL Server".equals( databaseName ) || "Adaptive Server Enterprise".equals( databaseName ) ) {
return new SybaseDialect(); return new SybaseASE15Dialect();
} }
if ( databaseName.startsWith( "Adaptive Server Anywhere" ) ) { if ( databaseName.startsWith( "Adaptive Server Anywhere" ) ) {