com.j256.ormlite.db
Class HsqldbDatabaseType

java.lang.Object
  extended by com.j256.ormlite.db.BaseDatabaseType
      extended by com.j256.ormlite.db.HsqldbDatabaseType
All Implemented Interfaces:
DatabaseType

public class HsqldbDatabaseType
extends BaseDatabaseType
implements DatabaseType

HyberSQL database type information used to create the tables, etc..

Author:
graywatson

Nested Class Summary
 
Nested classes/interfaces inherited from class com.j256.ormlite.db.BaseDatabaseType
BaseDatabaseType.BooleanNumberFieldConverter
 
Field Summary
 
Fields inherited from class com.j256.ormlite.db.BaseDatabaseType
booleanConverter
 
Constructor Summary
HsqldbDatabaseType()
           
 
Method Summary
protected  void appendBooleanType(StringBuilder sb)
          Output the SQL type for a Java boolean.
 void appendEscapedEntityName(StringBuilder sb, String word)
          Add a entity-name word to the string builder wrapped in the proper characters to escape it.
 void appendLimitValue(StringBuilder sb, int limit)
          Append to the string builder the necessary SQL to limit the results to a certain number.
protected  void appendObjectType(StringBuilder sb)
          Output the SQL type for a Java object.
 void appendSelectNextValFromSequence(StringBuilder sb, String sequenceName)
          Append the SQL necessary to get the next-value from a sequence.
protected  void configureGeneratedIdSequence(StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> additionalArgs, List<String> queriesAfter)
          Output the SQL necessary to configure a generated-id column.
 void dropColumnArg(FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter)
          Takes a FieldType and adds the necessary statements to the before and after lists necessary so that the dropping of the table will succeed and will clear other associated sequences or other database artifacts
 String getDriverClassName()
          Return the class name of the database driver.
 String getDriverUrlPart()
          Return the part in the database URI which identifies the particular database.
 boolean isEntityNamesMustBeUpCase()
          Returns true if table and field names should be made uppercase.
 boolean isIdSequenceNeeded()
          Return true if the database needs a sequence when you use generated IDs.
 boolean isLimitAfterSelect()
          Return true if the LIMIT should be called after SELECT otherwise at the end of the WHERE (the default).
 boolean isVarcharFieldWidthSupported()
          Return true if the database supports the width parameter on VARCHAR fields.
 
Methods inherited from class com.j256.ormlite.db.BaseDatabaseType
appendByteType, appendCanBeNull, appendColumnArg, appendCreateTableSuffix, appendDateType, appendDefaultValue, appendDoubleType, appendEnumIntType, appendEnumStringType, appendEscapedWord, appendFloatType, appendIntegerType, appendLongType, appendShortType, appendStringType, buildDatabaseAccess, configureGeneratedId, configureId, convertColumnName, generateIdSequenceName, getCommentLinePrefix, getDefaultVarcharWidth, getFieldConverter, isCreateTableReturnsZero, isLimitSqlSupported, loadDriver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.j256.ormlite.db.DatabaseType
appendColumnArg, appendCreateTableSuffix, appendEscapedWord, buildDatabaseAccess, convertColumnName, generateIdSequenceName, getCommentLinePrefix, getFieldConverter, isCreateTableReturnsZero, isLimitSqlSupported, loadDriver
 

Constructor Detail

HsqldbDatabaseType

public HsqldbDatabaseType()
Method Detail

getDriverUrlPart

public String getDriverUrlPart()
Description copied from interface: DatabaseType
Return the part in the database URI which identifies the particular database. Usually the URI is in the form jdbc:ddd:... where ddd is the driver url part.

Specified by:
getDriverUrlPart in interface DatabaseType

getDriverClassName

public String getDriverClassName()
Description copied from interface: DatabaseType
Return the class name of the database driver.

Specified by:
getDriverClassName in interface DatabaseType

appendBooleanType

protected void appendBooleanType(StringBuilder sb)
Description copied from class: BaseDatabaseType
Output the SQL type for a Java boolean.

Overrides:
appendBooleanType in class BaseDatabaseType

appendObjectType

protected void appendObjectType(StringBuilder sb)
Description copied from class: BaseDatabaseType
Output the SQL type for a Java object.

Overrides:
appendObjectType in class BaseDatabaseType

configureGeneratedIdSequence

protected void configureGeneratedIdSequence(StringBuilder sb,
                                            FieldType fieldType,
                                            List<String> statementsBefore,
                                            List<String> additionalArgs,
                                            List<String> queriesAfter)
Description copied from class: BaseDatabaseType
Output the SQL necessary to configure a generated-id column. This may add to the before statements list or additional arguments later. NOTE: Only one of configureGeneratedIdSequence, configureGeneratedId, or configureId will be called.

Overrides:
configureGeneratedIdSequence in class BaseDatabaseType

appendEscapedEntityName

public void appendEscapedEntityName(StringBuilder sb,
                                    String word)
Description copied from interface: DatabaseType
Add a entity-name word to the string builder wrapped in the proper characters to escape it. This avoids problems with table, column, and sequence-names being reserved words.

Specified by:
appendEscapedEntityName in interface DatabaseType
Overrides:
appendEscapedEntityName in class BaseDatabaseType

dropColumnArg

public void dropColumnArg(FieldType fieldType,
                          List<String> statementsBefore,
                          List<String> statementsAfter)
Description copied from interface: DatabaseType
Takes a FieldType and adds the necessary statements to the before and after lists necessary so that the dropping of the table will succeed and will clear other associated sequences or other database artifacts

Specified by:
dropColumnArg in interface DatabaseType
Overrides:
dropColumnArg in class BaseDatabaseType

isIdSequenceNeeded

public boolean isIdSequenceNeeded()
Description copied from interface: DatabaseType
Return true if the database needs a sequence when you use generated IDs. Some databases (H2, MySQL) create them auto-magically. This also means that the database needs to query for a sequence value before the object is inserted. For old[er] versions of Postgres, for example, the JDBC call-back stuff to get the just-inserted id value does not work so we have to get the next sequence value by hand, assign it into the object, and then insert the object -- yes two SQL statements.

Specified by:
isIdSequenceNeeded in interface DatabaseType
Overrides:
isIdSequenceNeeded in class BaseDatabaseType

isVarcharFieldWidthSupported

public boolean isVarcharFieldWidthSupported()
Description copied from interface: DatabaseType
Return true if the database supports the width parameter on VARCHAR fields.

Specified by:
isVarcharFieldWidthSupported in interface DatabaseType
Overrides:
isVarcharFieldWidthSupported in class BaseDatabaseType

isLimitAfterSelect

public boolean isLimitAfterSelect()
Description copied from interface: DatabaseType
Return true if the LIMIT should be called after SELECT otherwise at the end of the WHERE (the default).

Specified by:
isLimitAfterSelect in interface DatabaseType
Overrides:
isLimitAfterSelect in class BaseDatabaseType

appendLimitValue

public void appendLimitValue(StringBuilder sb,
                             int limit)
Description copied from interface: DatabaseType
Append to the string builder the necessary SQL to limit the results to a certain number.

Specified by:
appendLimitValue in interface DatabaseType
Overrides:
appendLimitValue in class BaseDatabaseType

appendSelectNextValFromSequence

public void appendSelectNextValFromSequence(StringBuilder sb,
                                            String sequenceName)
Description copied from interface: DatabaseType
Append the SQL necessary to get the next-value from a sequence. This is only necessary if DatabaseType.isIdSequenceNeeded() is true.

Specified by:
appendSelectNextValFromSequence in interface DatabaseType
Overrides:
appendSelectNextValFromSequence in class BaseDatabaseType

isEntityNamesMustBeUpCase

public boolean isEntityNamesMustBeUpCase()
Description copied from interface: DatabaseType
Returns true if table and field names should be made uppercase.

Turns out that Derby and Hsqldb are doing something wrong (IMO) with entity names. If you create a table with the name "footable" (with the quotes) then it will be created as lowercase footable, case sensitive. However, if you then issue the query 'select * from footable' it won't find the table because it gets promoted to be FOOTABLE and is searched in a case sensitive manner. So for these databases, entity names have to be forced to be uppercase so external queries will also work.

Specified by:
isEntityNamesMustBeUpCase in interface DatabaseType
Overrides:
isEntityNamesMustBeUpCase in class BaseDatabaseType


Copyright © 2010. All Rights Reserved.