com.j256.ormlite.db
Class DerbyEmbeddedDatabaseType

java.lang.Object
  extended by com.j256.ormlite.db.BaseDatabaseType
      extended by com.j256.ormlite.db.DerbyEmbeddedDatabaseType
All Implemented Interfaces:
DatabaseType
Direct Known Subclasses:
DerbyClientServerDatabaseType

public class DerbyEmbeddedDatabaseType
extends BaseDatabaseType
implements DatabaseType

Derby database type information used to create the tables, etc.. This is for an embedded Derby databse. For client connections to a remote Derby server, you should use DerbyClientServerDatabaseType.

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
DerbyEmbeddedDatabaseType()
           
 
Method Summary
protected  void appendBooleanType(StringBuilder sb)
          Output the SQL type for a Java boolean.
protected  void appendByteType(StringBuilder sb)
          Output the SQL type for a Java byte.
 void appendEscapedEntityName(StringBuilder sb, String word)
          Add a entity-name word to the string builder wrapped in the proper characters to escape it.
protected  void appendObjectType(StringBuilder sb)
          Output the SQL type for a Java object.
protected  void configureGeneratedId(StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> additionalArgs, List<String> queriesAfter)
          Output the SQL necessary to configure a generated-id column.
 String getDriverClassName()
          Return the class name of the database driver.
 String getDriverUrlPart()
          Return the part in the database URI which identifies the particular database.
 FieldConverter getFieldConverter(FieldType fieldType)
          Return the FieldConverter to associate with the FieldType.
 boolean isEntityNamesMustBeUpCase()
          Returns true if table and field names should be made uppercase.
 boolean isLimitSqlSupported()
          Return true if the database supports the LIMIT SQL command.
 
Methods inherited from class com.j256.ormlite.db.BaseDatabaseType
appendCanBeNull, appendColumnArg, appendCreateTableSuffix, appendDateType, appendDefaultValue, appendDoubleType, appendEnumIntType, appendEnumStringType, appendEscapedWord, appendFloatType, appendIntegerType, appendLimitValue, appendLongType, appendSelectNextValFromSequence, appendShortType, appendStringType, buildDatabaseAccess, configureGeneratedIdSequence, configureId, convertColumnName, dropColumnArg, generateIdSequenceName, getCommentLinePrefix, getDefaultVarcharWidth, isCreateTableReturnsZero, isIdSequenceNeeded, isLimitAfterSelect, isVarcharFieldWidthSupported, 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, appendLimitValue, appendSelectNextValFromSequence, buildDatabaseAccess, convertColumnName, dropColumnArg, generateIdSequenceName, getCommentLinePrefix, isCreateTableReturnsZero, isIdSequenceNeeded, isLimitAfterSelect, isVarcharFieldWidthSupported, loadDriver
 

Constructor Detail

DerbyEmbeddedDatabaseType

public DerbyEmbeddedDatabaseType()
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

getFieldConverter

public FieldConverter getFieldConverter(FieldType fieldType)
Description copied from interface: DatabaseType
Return the FieldConverter to associate with the FieldType. This allows the database instance to convert a field as necessary before it goes to the database.

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

appendBooleanType

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

Overrides:
appendBooleanType in class BaseDatabaseType

appendByteType

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

Overrides:
appendByteType 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

configureGeneratedId

protected void configureGeneratedId(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:
configureGeneratedId 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

isLimitSqlSupported

public boolean isLimitSqlSupported()
Description copied from interface: DatabaseType
Return true if the database supports the LIMIT SQL command. Otherwise we have to use the Statement.setMaxRows(int) instead. See prepareSqlStatement in MappedPreparedQuery.

Specified by:
isLimitSqlSupported in interface DatabaseType
Overrides:
isLimitSqlSupported 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.