com.is.jrf
Class HypersonicDatabasePolicy

java.lang.Object
  |
  +--com.is.jrf.HypersonicDatabasePolicy
All Implemented Interfaces:
DatabasePolicy

public class HypersonicDatabasePolicy
extends java.lang.Object
implements DatabasePolicy

Instances of this class perform Hypersonic-specific logic and return Hypersonic-specific information.


Constructor Summary
HypersonicDatabasePolicy()
           
 
Method Summary
 java.lang.String autoIncrementIdentifier()
          Hypersonic uses auto-increment for assigning arbitrary primary key ids.
 void createSequence(AbstractDomain domain, JDBCHelper aJDBCHelper)
          This method creates a sequence for the domain object.
 java.lang.String currentTimestampSQL()
          This should return the the SQL to use to have the database return the current timestamp.
 java.lang.Long findAutoIncrementId(java.lang.String tableName, java.lang.String columnName, JDBCHelper aJDBCHelper)
          This method uses a non-standard Hypersonic SQL call.
 java.lang.String formatDate(java.sql.Date sqlDate)
          The result of this is used in SQL.
 java.lang.String formatTimestamp(java.sql.Timestamp ts)
          The return value should be in the format that the database recognizes for a timestamp.
 java.lang.String outerWhereJoin(java.lang.String mainTableColumn, java.lang.String joinTableColumn)
          Outer WHERE joins are not supported in Hypersonic, so this just returns a normal join.
 java.lang.String sequenceSQL(java.lang.String tableName)
          Hypersonic uses auto-increment at time of insert instead of sequences.
 java.lang.String timestampColumnType()
          This method is used when building SQL to create tables.
 java.lang.String timestampFunction()
          This is the string value (function name) to put into the SQL to tell the database to insert the current timestamp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HypersonicDatabasePolicy

public HypersonicDatabasePolicy()
Method Detail

sequenceSQL

public java.lang.String sequenceSQL(java.lang.String tableName)
Hypersonic uses auto-increment at time of insert instead of sequences.
Specified by:
sequenceSQL in interface DatabasePolicy
Parameters:
tableName - a value of type 'String'
Returns:
a value of type 'String'

createSequence

public void createSequence(AbstractDomain domain,
                           JDBCHelper aJDBCHelper)
                    throws java.sql.SQLException
Description copied from interface: DatabasePolicy
This method creates a sequence for the domain object. If the sequence already exists, it will be reset to the beginning (usually 0).
Specified by:
createSequence in interface DatabasePolicy
Following copied from interface: com.is.jrf.DatabasePolicy
Parameters:
domain - a value of type 'AbstractDomain'
aJDBCHelper - a value of type 'JDBCHelper'
Throws:
java.sql.SQLException - if an error occurs

timestampFunction

public java.lang.String timestampFunction()
This is the string value (function name) to put into the SQL to tell the database to insert the current timestamp.
Specified by:
timestampFunction in interface DatabasePolicy
Returns:
a value of type 'String'

formatTimestamp

public java.lang.String formatTimestamp(java.sql.Timestamp ts)
The return value should be in the format that the database recognizes for a timestamp.
Specified by:
formatTimestamp in interface DatabasePolicy
Parameters:
ts - a value of type 'Timestamp'
Returns:
a value of type 'String'

formatDate

public java.lang.String formatDate(java.sql.Date sqlDate)
The result of this is used in SQL. This will return only the date (not the time portion)
Specified by:
formatDate in interface DatabasePolicy
Parameters:
sqlDate - a value of type 'java.sql.Date'
Returns:
a value of type 'String'

currentTimestampSQL

public java.lang.String currentTimestampSQL()
This should return the the SQL to use to have the database return the current timestamp.
Specified by:
currentTimestampSQL in interface DatabasePolicy
Returns:
a value of type 'String'

autoIncrementIdentifier

public java.lang.String autoIncrementIdentifier()
Hypersonic uses auto-increment for assigning arbitrary primary key ids.
Specified by:
autoIncrementIdentifier in interface DatabasePolicy
Returns:
a value of type 'String'

findAutoIncrementId

public java.lang.Long findAutoIncrementId(java.lang.String tableName,
                                          java.lang.String columnName,
                                          JDBCHelper aJDBCHelper)
This method uses a non-standard Hypersonic SQL call.
Specified by:
findAutoIncrementId in interface DatabasePolicy
Parameters:
tableName - a value of type 'String'
columnName - a value of type 'String'
aJDBCHelper - a value of type 'JDBCHelper'
Returns:
a value of type 'Long'

outerWhereJoin

public java.lang.String outerWhereJoin(java.lang.String mainTableColumn,
                                       java.lang.String joinTableColumn)
Outer WHERE joins are not supported in Hypersonic, so this just returns a normal join.
Specified by:
outerWhereJoin in interface DatabasePolicy
Parameters:
mainTableColumn - a value of type 'String'
joinTableColumn - a value of type 'String'
sqlBuffer - a value of type 'StringBuffer'
Returns:
a value of type 'String'

timestampColumnType

public java.lang.String timestampColumnType()
This method is used when building SQL to create tables.
Specified by:
timestampColumnType in interface DatabasePolicy
Returns:
a value of type 'String'