HHH-2857 : assume schema support in HSQLDialect

git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@14085 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2007-10-16 21:09:15 +00:00
parent be5cc9d364
commit 0fe95705fe
1 changed files with 4 additions and 21 deletions

View File

@ -11,7 +11,6 @@ import org.hibernate.StaleObjectStateException;
import org.hibernate.JDBCException; import org.hibernate.JDBCException;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.persister.entity.Lockable; import org.hibernate.persister.entity.Lockable;
import org.hibernate.util.ReflectHelper;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction; import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction; import org.hibernate.dialect.function.StandardSQLFunction;
@ -29,14 +28,13 @@ import org.apache.commons.logging.LogFactory;
* <p/> * <p/>
* Note this version supports HSQLDB version 1.8 and higher, only. * Note this version supports HSQLDB version 1.8 and higher, only.
* *
* @author Christoph Sturm, Phillip Baird * @author Christoph Sturm
* @author Phillip Baird
*/ */
public class HSQLDialect extends Dialect { public class HSQLDialect extends Dialect {
private static final Log log = LogFactory.getLog( HSQLDialect.class ); private static final Log log = LogFactory.getLog( HSQLDialect.class );
private boolean schemaSupport;
public HSQLDialect() { public HSQLDialect() {
super(); super();
registerColumnType( Types.BIGINT, "bigint" ); registerColumnType( Types.BIGINT, "bigint" );
@ -130,17 +128,6 @@ public class HSQLDialect extends Dialect {
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) ); registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE ); getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
try {
// Does present HSQLDB Database class support schemas?
// yuck! Perhaps we should think about a new dialect? Especially
// if more things are going to break back-compat moving forward
ReflectHelper.classForName( "org.hsqldb.Database" ).getDeclaredField( "schemaManager" );
schemaSupport = true;
}
catch (Throwable t) {
schemaSupport = false;
}
} }
public String getAddColumnString() { public String getAddColumnString() {
@ -219,12 +206,8 @@ public class HSQLDialect extends Dialect {
} }
public String getQuerySequencesString() { public String getQuerySequencesString() {
if ( schemaSupport ) { // this assumes schema support, which is present in 1.8.0 and later...
return "select sequence_name from information_schema.system_sequences"; return "select sequence_name from information_schema.system_sequences";
}
else {
return "select sequence_name from system_sequences";
}
} }
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() { public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {