From 5e8e49d3ae8ae9d2a6ab6849f9c44ce013b87bd3 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Tue, 5 Apr 2011 10:26:58 -0500 Subject: [PATCH] HHH-6073 --- .../main/java/org/hibernate/HibernateLogger.java | 4 ++++ .../java/org/hibernate/dialect/DerbyDialect.java | 4 ++++ .../hibernate/dialect/DerbyTenFiveDialect.java | 5 ----- .../hibernate/dialect/DerbyTenSixDialect.java | 12 +----------- .../internal/StandardDialectResolver.java | 16 ++++++++-------- 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/HibernateLogger.java b/hibernate-core/src/main/java/org/hibernate/HibernateLogger.java index ca1720eb0e..c8bda81379 100644 --- a/hibernate-core/src/main/java/org/hibernate/HibernateLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/HibernateLogger.java @@ -1858,4 +1858,8 @@ public interface HibernateLogger extends BasicLogger { @LogMessage( level = WARN ) @Message( value = "Setting entity-identifier value binding where one already existed : %s.", id = 429 ) void entityIdentifierValueBindingExists(String name); + + @LogMessage( level = WARN ) + @Message( value = "The DerbyDialect dialect has been deprecated; use one of the version-specific dialects instead", id = 430 ) + void deprecatedDerbyDialect(); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java index 335915cb82..1f3983d131 100755 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java @@ -40,7 +40,10 @@ import org.jboss.logging.Logger; * http://www.jroller.com/comments/kenlars99/Weblog/cloudscape_soon_to_be_derby * * @author Simon Johnston + * + * @deprecated HHH-6073 */ +@Deprecated public class DerbyDialect extends DB2Dialect { private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, DerbyDialect.class.getName()); @@ -50,6 +53,7 @@ public class DerbyDialect extends DB2Dialect { public DerbyDialect() { super(); + LOG.deprecatedDerbyDialect(); registerFunction( "concat", new DerbyConcatFunction() ); registerFunction( "trim", new AnsiTrimFunction() ); determineDriverVersion(); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyTenFiveDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyTenFiveDialect.java index 8e6dea3c73..0038f099c1 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyTenFiveDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyTenFiveDialect.java @@ -23,10 +23,8 @@ */ package org.hibernate.dialect; -import org.hibernate.HibernateLogger; import org.hibernate.dialect.function.AnsiTrimFunction; import org.hibernate.dialect.function.DerbyConcatFunction; -import org.jboss.logging.Logger; /** @@ -39,9 +37,6 @@ import org.jboss.logging.Logger; * @author Scott Marlow */ public class DerbyTenFiveDialect extends DerbyDialect { - - private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, DerbyTenFiveDialect.class.getName()); - public DerbyTenFiveDialect() { super(); registerFunction( "concat", new DerbyConcatFunction() ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyTenSixDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyTenSixDialect.java index 05d2ebe71a..a498610b2c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyTenSixDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyTenSixDialect.java @@ -23,9 +23,6 @@ */ package org.hibernate.dialect; -import org.hibernate.HibernateLogger; -import org.jboss.logging.Logger; - /** * Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an * override for the identity column generator as well as for the case statement @@ -36,19 +33,12 @@ import org.jboss.logging.Logger; * @author Scott Marlow */ public class DerbyTenSixDialect extends DerbyTenFiveDialect { - - private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, DerbyTenSixDialect.class.getName()); - public DerbyTenSixDialect() { super(); } - private boolean isTenPointFiveReleaseOrNewer() { - return true; - } - @Override public boolean supportsSequences() { - return true; + return true; } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/StandardDialectResolver.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/StandardDialectResolver.java index 6cdba008ba..02d628a7a9 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/StandardDialectResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/dialect/internal/StandardDialectResolver.java @@ -82,15 +82,15 @@ public class StandardDialectResolver extends AbstractDialectResolver { if ( "Apache Derby".equals( databaseName ) ) { int driverVersionMajor = metaData.getDriverMajorVersion(); int driverVersionMinor = metaData.getDriverMinorVersion(); - if ( driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 5 ) ) { - if ( driverVersionMinor >= 6 ) { - return new DerbyTenSixDialect(); - } - else { - return new DerbyTenFiveDialect(); - } + if ( driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 6 ) ) { + return new DerbyTenSixDialect(); + } + else if ( driverVersionMajor == 10 && driverVersionMinor == 5 ) { + return new DerbyTenFiveDialect(); + } + else { + return new DerbyDialect(); } - return new DerbyDialect(); } if ( "ingres".equalsIgnoreCase( databaseName ) ) {