HHH-6073 Dialects shouldn't use TCCL (revised to leave DerbyDialect alone)
This commit is contained in:
parent
1da2262a4a
commit
a67b6028c1
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. 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 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
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an
|
||||||
|
* override for the identity column generator as well as for the case statement
|
||||||
|
* issue documented at:
|
||||||
|
* http://www.jroller.com/comments/kenlars99/Weblog/cloudscape_soon_to_be_derby
|
||||||
|
*
|
||||||
|
* @author Simon Johnston
|
||||||
|
* @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() );
|
||||||
|
registerFunction( "trim", new AnsiTrimFunction() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsSequences() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsLimit() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsLimitOffset() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. 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 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
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
* issue documented at:
|
||||||
|
* http://www.jroller.com/comments/kenlars99/Weblog/cloudscape_soon_to_be_derby
|
||||||
|
*
|
||||||
|
* @author Simon Johnston
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,8 @@ import java.sql.SQLException;
|
||||||
import org.hibernate.HibernateLogger;
|
import org.hibernate.HibernateLogger;
|
||||||
import org.hibernate.dialect.DB2Dialect;
|
import org.hibernate.dialect.DB2Dialect;
|
||||||
import org.hibernate.dialect.DerbyDialect;
|
import org.hibernate.dialect.DerbyDialect;
|
||||||
|
import org.hibernate.dialect.DerbyTenFiveDialect;
|
||||||
|
import org.hibernate.dialect.DerbyTenSixDialect;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.dialect.H2Dialect;
|
import org.hibernate.dialect.H2Dialect;
|
||||||
import org.hibernate.dialect.HSQLDialect;
|
import org.hibernate.dialect.HSQLDialect;
|
||||||
|
@ -78,6 +80,16 @@ public class StandardDialectResolver extends AbstractDialectResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( "Apache Derby".equals( databaseName ) ) {
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
return new DerbyDialect();
|
return new DerbyDialect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue