FileDocCategorySizeDatePackage
TimesTenDialect.javaAPI DocHibernate 3.2.56056Fri Dec 08 09:06:50 GMT 2006org.hibernate.dialect

TimesTenDialect

public class TimesTenDialect extends Dialect
A SQL dialect for TimesTen 5.1. Known limitations: joined-subclass support because of no CASE support in TimesTen No support for subqueries that includes aggregation - size() in HQL not supported - user queries that does subqueries with aggregation No CLOB/BLOB support No cascade delete support. No Calendar support No support for updating primary keys.
author
Sherry Listgarten and Max Andersen

Fields Summary
Constructors Summary
public TimesTenDialect()

		super();
		registerColumnType( Types.BIT, "TINYINT" );
		registerColumnType( Types.BIGINT, "BIGINT" );
		registerColumnType( Types.SMALLINT, "SMALLINT" );
		registerColumnType( Types.TINYINT, "TINYINT" );
		registerColumnType( Types.INTEGER, "INTEGER" );
		registerColumnType( Types.CHAR, "CHAR(1)" );
		registerColumnType( Types.VARCHAR, "VARCHAR($l)" );
		registerColumnType( Types.FLOAT, "FLOAT" );
		registerColumnType( Types.DOUBLE, "DOUBLE" );
		registerColumnType( Types.DATE, "DATE" );
		registerColumnType( Types.TIME, "TIME" );
		registerColumnType( Types.TIMESTAMP, "TIMESTAMP" );
		registerColumnType( Types.VARBINARY, "VARBINARY($l)" );
		registerColumnType( Types.NUMERIC, "DECIMAL($p, $s)" );
		// TimesTen has no BLOB/CLOB support, but these types may be suitable
		// for some applications. The length is limited to 4 million bytes.
        registerColumnType( Types.BLOB, "VARBINARY(4000000)" );
        registerColumnType( Types.CLOB, "VARCHAR(4000000)" );

		getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true");
		getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
		registerFunction( "lower", new StandardSQLFunction("lower") );
		registerFunction( "upper", new StandardSQLFunction("upper") );
		registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
		registerFunction( "concat", new StandardSQLFunction("concat", Hibernate.STRING) );
		registerFunction( "mod", new StandardSQLFunction("mod") );
		registerFunction( "to_char", new StandardSQLFunction("to_char",Hibernate.STRING) );
		registerFunction( "to_date", new StandardSQLFunction("to_date",Hibernate.TIMESTAMP) );
		registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.TIMESTAMP, false) );
		registerFunction( "getdate", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP, false) );
		registerFunction( "nvl", new StandardSQLFunction("nvl") );

	
Methods Summary
public org.hibernate.sql.JoinFragmentcreateOuterJoinFragment()

		return new OracleJoinFragment();
	
public booleandropConstraints()

            return true;
	
public java.lang.StringgenerateTemporaryTableName(java.lang.String baseTableName)

		String name = super.generateTemporaryTableName(baseTableName);
		return name.length() > 30 ? name.substring( 1, 30 ) : name;
	
public java.lang.StringgetAddColumnString()

            return "add";
	
public java.lang.StringgetCreateSequenceString(java.lang.String sequenceName)

		return "create sequence " + sequenceName;
	
public java.lang.StringgetCreateTemporaryTablePostfix()

		return "on commit delete rows";
	
public java.lang.StringgetCreateTemporaryTableString()

		return "create global temporary table";
	
public java.lang.StringgetCurrentTimestampSelectString()

		return "select first 1 sysdate from sys.tables";
	
public java.lang.StringgetDropSequenceString(java.lang.String sequenceName)

		return "drop sequence " + sequenceName;
	
public java.lang.StringgetForUpdateString()

		return "";
	
public java.lang.StringgetLimitString(java.lang.String querySelect, int offset, int limit)

		if ( offset > 0 ) {
			throw new UnsupportedOperationException( "TimesTen does not support offset" );
		}
		return new StringBuffer( querySelect.length()+8 )
			.append(querySelect)
			.insert( 6, " first " + limit )
			.toString();
	
public org.hibernate.dialect.lock.LockingStrategygetLockingStrategy(org.hibernate.persister.entity.Lockable lockable, org.hibernate.LockMode lockMode)

		// TimesTen has no known variation of a "SELECT ... FOR UPDATE" syntax...
		if ( lockMode.greaterThan( LockMode.READ ) ) {
			return new UpdateLockingStrategy( lockable, lockMode );
		}
		else {
			return new SelectLockingStrategy( lockable, lockMode );
		}
	
public java.lang.StringgetQuerySequencesString()

		return "select NAME from sys.sequences";
	
public java.lang.StringgetSelectSequenceNextValString(java.lang.String sequenceName)

		return sequenceName + ".nextval";
	
public java.lang.StringgetSequenceNextValString(java.lang.String sequenceName)

		return "select first 1 " + sequenceName + ".nextval from sys.tables";
	
public booleanisCurrentTimestampSelectStringCallable()

		return false;
	
public booleanqualifyIndexName()

            return false;
	
public booleansupportsColumnCheck()

		return false;
	
public booleansupportsCurrentTimestampSelection()

		return true;
	
public booleansupportsEmptyInList()

		return false;
	
public booleansupportsLimit()

		return true;
	
public booleansupportsLimitOffset()

		return false;
	
public booleansupportsSequences()

		return true;
	
public booleansupportsTableCheck()

		return false;
	
public booleansupportsTemporaryTables()

		return true;
	
public booleansupportsUnique()

		return false;
	
public booleansupportsUniqueConstraintInCreateAlterTable()

		return false;
	
public booleansupportsVariableLimit()

		return false;
	
public booleanuseMaxForLimit()

		return true;