Class HSQLPlatform
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
- org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
- org.eclipse.persistence.platform.database.DatabasePlatform
-
- org.eclipse.persistence.platform.database.HSQLPlatform
-
- All Implemented Interfaces:
Serializable,Cloneable,org.eclipse.persistence.internal.core.databaseaccess.CorePlatform<org.eclipse.persistence.internal.helper.ConversionManager>,org.eclipse.persistence.internal.databaseaccess.Platform
public class HSQLPlatform extends DatabasePlatform
Purpose: Provides HSQL specific behavior. Support HSQL functionality as of 1.8.1.
Includes:
- DDL creation
- IDENTITY sequencing
- SEQUENCE objects
- Functions
- Pagination
- Since:
- TOPLink/Java 4.5
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.platform.database.DatabasePlatform
DEFAULT_VARCHAR_SIZE
-
-
Constructor Summary
Constructors Constructor Description HSQLPlatform()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueReadQuerybuildSelectQueryForIdentity()INTERNAL: Returns query used to read back the value generated by Identity.ValueReadQuerybuildSelectQueryForSequenceObject(String seqName, Integer size)INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence).WriterbuildSequenceObjectCreationWriter(Writer writer, String fullSeqName, int increment, int start)INTERNAL: HSQL requires START WITH first.intcomputeMaxRowsForSQL(int firstResultIndex, int maxResults)INTERNAL: Use the JDBC maxResults and firstResultIndex setting to compute a value to use when limiting the results of a query in SQL.ValueReadQuerygetTimestampQuery()This method can be overridden by subclasses to return a query that will return the timestamp from the server.booleanisAlterSequenceObjectSupported()INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.booleanisDynamicSQLRequiredForFunctions()INTERNAL HSQL has some issues with using parameters on certain functions and relations.booleanisHSQL()voidprintFieldIdentityClause(Writer writer)Append the receiver's field 'identity' constraint clause to a writer.voidprintSQLSelectStatement(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)Print the pagination SQL using HSQL syntax "SELECT LIMIT <first> <max>".booleanshouldUseJDBCOuterJoinSyntax()JDBC escape syntax for outer joins is not supported (not required).booleansupportsGlobalTempTables()INTERNAL: Indicates whether the platform supports global temporary tables.booleansupportsIdentity()INTERNAL: Indicates whether the platform supports identity.booleansupportsNestingOuterJoins()Does not allow nesting outer joins, i.e.booleansupportsSequenceObjects()INTERNAL: Indicates whether the platform supports sequence objects.booleansupportsUniqueColumns()HSQL (1.8.1) does not support the UNIQUE key word in a column, but does support unique constraints defined separately.static ExpressionOperatortoNumberOperator()INTERNAL: Use CONVERT function for toNumber.static ExpressionOperatortrimOperator()INTERNAL: Use TRIM(FROM ?) function for trim.voidwriteUpdateOriginalFromTempTableSql(Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, Collection pkFields, Collection assignedFields)INTERNAL: HSQL does not allow multiple fields to be set as a list, so each field needs to be set one by one.-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
addBatch, addStructConverter, allowsSizeInProcedureArguments, appendLiteralToCall, appendParameter, appendParameterInternal, autoCommit, beginTransaction, buildBatchCriteria, buildBatchCriteriaForComplexId, buildCallWithReturning, buildCreateIndex, buildCreateIndex, buildDropIndex, buildDropIndex, buildProcedureCallString, buildSequenceObjectAlterIncrementWriter, buildSequenceObjectDeletionWriter, canBatchWriteWithOptimisticLocking, canBuildCallWithReturning, commitTransaction, convertToDatabaseType, copyInto, createArray, createArray, createStruct, createStruct, dontBindUpdateAllQueryUsingTempTables, executeBatch, executeStoredProcedure, freeTemporaryObject, getAssignmentString, getBatchBeginString, getBatchDelimiterString, getBatchEndString, getBatchRowCountAssignString, getBatchRowCountDeclareString, getBatchRowCountReturnString, getBatchWritingMechanism, getCastSizeForVarcharParameter, getClassTypes, getConnection, getConnectionUserName, getConstraintDeletionString, getCreateDatabaseSchemaString, getCreateViewString, getCreationInOutputProcedureToken, getCreationOutputProcedureToken, getCursorCode, getCustomModifyValueForCall, getDefaultSequenceTableName, getDriverSupportsNVarChar, getDropCascadeString, getDropDatabaseSchemaString, getFieldTypeDefinition, getFieldTypes, getFunctionCallHeader, getIdentifierQuoteCharacter, getIndexNamePrefix, getInOutputProcedureToken, getInputProcedureToken, getJDBCOuterJoinString, getJDBCType, getJDBCType, getJDBCTypeForSetNull, getJdbcTypeName, getMaxBatchWritingSize, getMaxFieldNameSize, getMaxForeignKeyNameSize, getMaxIndexNameSize, getMaxUniqueKeyNameSize, getNoWaitString, getObjectFromResultSet, getOutputProcedureToken, getPartitioningCallback, getPingSQL, getProcedureArgumentSetter, getProcedureArgumentString, getProcedureAsString, getProcedureBeginString, getProcedureCallHeader, getProcedureCallTail, getProcedureEndString, getQualifiedName, getQualifiedSequenceTableName, getRefValue, getRefValue, getSelectForUpdateNoWaitString, getSelectForUpdateOfString, getSelectForUpdateString, getSelectForUpdateWaitString, getSequenceCounterFieldName, getSequenceNameFieldName, getSequencePreallocationSize, getSequenceTableName, getStatementCacheSize, getStoredProcedureParameterPrefix, getStoredProcedureTerminationToken, getStringBindingSize, getStructConverters, getTableCreationSuffix, getTempTableForTable, getTransactionIsolation, getTypeConverters, getUniqueConstraintDeletionString, getUseNationalCharacterVaryingTypeForString, getVPDClearIdentifierQuery, getVPDCreationFunctionString, getVPDCreationPolicyString, getVPDDeletionString, getVPDSetIdentifierQuery, hasPartitioningCallback, initialize, initializeConnectionData, isCastRequired, isForUpdateCompatibleWithDistinct, isInformixOuterJoin, isJDBCExecuteCompliant, isLobCompatibleWithDistinct, isLockTimeoutException, isNullAllowedInSelectClause, isOutputAllowWithResultSet, isRowCountOutputParameterRequired, isXDBDocument, maximumNumericValues, minimumNumericValues, minimumTimeIncrement, prepareBatchStatement, printFieldNotNullClause, printFieldNullClause, printFieldTypeSize, printFieldUnique, printStoredFunctionReturnKeyWord, printValuelist, printValuelist, registerOutputParameter, requiresNamedPrimaryKeyConstraints, requiresProcedureBrackets, requiresProcedureCallBrackets, requiresProcedureCallOuputToken, requiresTableInIndexDropDDL, requiresTypeNameToRegisterOutputParameter, requiresUniqueConstraintCreationOnTableCreate, retrieveFirstPrimaryKeyOrOne, rollbackTransaction, setBatchWritingMechanism, setCastSizeForVarcharParameter, setCursorCode, setDriverName, setDriverSupportsNVarChar, setIsCastRequired, setMaxBatchWritingSize, setParameterValueInDatabaseCall, setPartitioningCallback, setPingSQL, setPrintInnerJoinInWhereClause, setPrintOuterJoinInWhereClause, setSequenceCounterFieldName, setSequenceNameFieldName, setSequenceTableName, setShouldBindAllParameters, setShouldBindLiterals, setShouldCacheAllStatements, setShouldCreateIndicesOnForeignKeys, setShouldForceFieldNamesToUpperCase, setShouldIgnoreCaseOnFieldComparisons, setShouldOptimizeDataConversion, setShouldTrimStrings, setShouldUseRownumFiltering, setStatementCacheSize, setStoredProcedureTerminationToken, setStringBindingSize, setSupportsAutoCommit, setTableCreationSuffix, setTransactionIsolation, setUseJDBCStoredProcedureSyntax, setUseNationalCharacterVaryingTypeForString, setUsesBatchWriting, setUsesByteArrayBinding, setUsesJDBCBatchWriting, setUsesNativeBatchWriting, setUsesNativeSQL, setUsesStreamsForBinding, setUsesStringBinding, shouldAlwaysUseTempStorageForModifyAll, shouldBindAllParameters, shouldBindLiterals, shouldCacheAllStatements, shouldCreateIndicesForPrimaryKeys, shouldCreateIndicesOnForeignKeys, shouldCreateIndicesOnUniqueKeys, shouldForceFieldNamesToUpperCase, shouldIgnoreCaseOnFieldComparisons, shouldIgnoreException, shouldOptimizeDataConversion, shouldPrintAliasForUpdate, shouldPrintConstraintNameAfter, shouldPrintFieldIdentityClause, shouldPrintForUpdateClause, shouldPrintInnerJoinInWhereClause, shouldPrintInOutputTokenBeforeType, shouldPrintInputTokenAtStart, shouldPrintLockingClauseAfterWhereClause, shouldPrintOuterJoinInWhereClause, shouldPrintOutputTokenAtStart, shouldPrintOutputTokenBeforeType, shouldPrintStoredProcedureArgumentNameInCall, shouldPrintStoredProcedureVariablesAfterBeginString, shouldTrimStrings, shouldUseCustomModifyForCall, shouldUseGetSetNString, shouldUseRownumFiltering, supportsANSIInnerJoinSyntax, supportsAutoCommit, supportsAutoConversionToNumericForArithmeticOperations, supportsConnectionUserName, supportsCountDistinctWithMultipleFields, supportsDeleteOnCascade, supportsForeignKeyConstraints, supportsIndexes, supportsIndividualTableLocking, supportsLocalTempTables, supportsLockingQueriesWithMultipleTables, supportsOuterJoinsWithBrackets, supportsPrimaryKeyConstraint, supportsStoredFunctions, supportsTempTables, supportsUniqueKeyConstraints, supportsVPD, usesBatchWriting, usesByteArrayBinding, usesJDBCBatchWriting, usesNativeBatchWriting, usesNativeSQL, usesSequenceTable, usesStreamsForBinding, usesStringBinding, wasFailureCommunicationBased, writeAddColumnClause, writeCleanUpTempTableSql, writeCreateTempTableSql, writeDeleteFromTargetTableUsingTempTableSql, writeInsertIntoTableSql, writeLOB, writeParameterMarker, writeTableCreationSuffix
-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
addSequence, addSequence, buildNativeCall, buildSelectQueryForIdentity, buildSelectQueryForSequenceObject, clone, convertObject, createConnectionCustomizer, getConversionManager, getDataTypesConvertedFrom, getDataTypesConvertedTo, getDefaultNativeSequenceToTable, getDefaultSequence, getDefaultSequenceToWrite, getEndDelimiter, getOperator, getPlatformOperators, getSelectSequenceQuery, getSequence, getSequences, getSequencesToWrite, getStartDelimiter, getTableQualifier, getTimestampFromServer, getUpdateSequenceQuery, hasDefaultSequence, initializeDefaultQueries, isAccess, isAttunity, isCloudscape, isDB2, isDBase, isDerby, isFirebird, isH2, isHANA, isInformix, isMaxDB, isMySQL, isODBC, isOracle, isOracle9, isPervasive, isPointBase, isPostgreSQL, isSQLAnywhere, isSQLServer, isSybase, isSymfoware, isTimesTen, isTimesTen7, removeAllSequences, removeSequence, setConversionManager, setDefaultNativeSequenceToTable, setDefaultSequence, setEndDelimiter, setSelectSequenceNumberQuery, setSequencePreallocationSize, setSequences, setStartDelimiter, setTableQualifier, setTimestampQuery, setUpdateSequenceQuery, shouldNativeSequenceUseTransaction, shouldPrepare, shouldSelectDistinctIncludeOrderBy, shouldSelectIncludeOrderBy, supportsNativeSequenceNumbers, toString, usesPlatformDefaultSequence
-
-
-
-
Method Detail
-
toNumberOperator
public static ExpressionOperator toNumberOperator()
INTERNAL: Use CONVERT function for toNumber.
-
trimOperator
public static ExpressionOperator trimOperator()
INTERNAL: Use TRIM(FROM ?) function for trim.
-
isHSQL
public boolean isHSQL()
- Specified by:
isHSQLin interfaceorg.eclipse.persistence.internal.databaseaccess.Platform- Overrides:
isHSQLin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
supportsUniqueColumns
public boolean supportsUniqueColumns()
HSQL (1.8.1) does not support the UNIQUE key word in a column, but does support unique constraints defined separately. This allows the column setting to be generated as a constraint.- Overrides:
supportsUniqueColumnsin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
supportsIdentity
public boolean supportsIdentity()
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatasourcePlatformINTERNAL: Indicates whether the platform supports identity. This method is to be used *ONLY* by sequencing classes- Overrides:
supportsIdentityin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
buildSelectQueryForIdentity
public ValueReadQuery buildSelectQueryForIdentity()
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatasourcePlatformINTERNAL: Returns query used to read back the value generated by Identity. This method is called when identity NativeSequence is connected, the returned query used until the sequence is disconnected. If the platform supportsIdentity then (at least) one of buildSelectQueryForIdentity methods should return non-null query.- Overrides:
buildSelectQueryForIdentityin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
printFieldIdentityClause
public void printFieldIdentityClause(Writer writer) throws ValidationException
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatabasePlatformAppend the receiver's field 'identity' constraint clause to a writer.- Overrides:
printFieldIdentityClausein classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
ValidationException
-
isDynamicSQLRequiredForFunctions
public boolean isDynamicSQLRequiredForFunctions()
INTERNAL HSQL has some issues with using parameters on certain functions and relations. This allows statements to disable binding only in these cases.- Overrides:
isDynamicSQLRequiredForFunctionsin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
shouldUseJDBCOuterJoinSyntax
public boolean shouldUseJDBCOuterJoinSyntax()
JDBC escape syntax for outer joins is not supported (not required).- Overrides:
shouldUseJDBCOuterJoinSyntaxin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
supportsNestingOuterJoins
public boolean supportsNestingOuterJoins()
Does not allow nesting outer joins, i.e. each join must be followed by the ON clause.- Overrides:
supportsNestingOuterJoinsin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
supportsSequenceObjects
public boolean supportsSequenceObjects()
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatasourcePlatformINTERNAL: Indicates whether the platform supports sequence objects. This method is to be used *ONLY* by sequencing classes- Overrides:
supportsSequenceObjectsin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
isAlterSequenceObjectSupported
public boolean isAlterSequenceObjectSupported()
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatabasePlatformINTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.- Overrides:
isAlterSequenceObjectSupportedin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
buildSelectQueryForSequenceObject
public ValueReadQuery buildSelectQueryForSequenceObject(String seqName, Integer size)
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatasourcePlatformINTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence). In case the other version of this method (taking no parameters) returns null, this method is called every time sequence object NativeSequence reads. If the platform supportsSequenceObjects then (at least) one of buildSelectQueryForSequenceObject methods should return non-null query.- Overrides:
buildSelectQueryForSequenceObjectin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
supportsGlobalTempTables
public boolean supportsGlobalTempTables()
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatabasePlatformINTERNAL: Indicates whether the platform supports global temporary tables. "Global" means that an attempt to create temporary table with the same name for the second time results in exception. EclipseLink attempts to create global temporary table in the beginning of UpdateAllQuery, execution and assumes that it already exists in case SQLException results. In the end of UpdateAllQuery execution all rows are removed from the temporary table - it is necessary in case the same temporary table will be used by another UpdateAllQuery in the same transaction. Override this method if the platform supports global temporary tables. Note that this method is ignored in case supportsLocalTempTables() returns true.- Overrides:
supportsGlobalTempTablesin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
writeUpdateOriginalFromTempTableSql
public void writeUpdateOriginalFromTempTableSql(Writer writer, org.eclipse.persistence.internal.helper.DatabaseTable table, Collection pkFields, Collection assignedFields) throws IOException
INTERNAL: HSQL does not allow multiple fields to be set as a list, so each field needs to be set one by one.- Overrides:
writeUpdateOriginalFromTempTableSqlin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
IOException
-
computeMaxRowsForSQL
public int computeMaxRowsForSQL(int firstResultIndex, int maxResults)INTERNAL: Use the JDBC maxResults and firstResultIndex setting to compute a value to use when limiting the results of a query in SQL. These limits tend to be used in two ways. 1. MaxRows is the index of the last row to be returned (like JDBC maxResults) 2. MaxRows is the number of rows to be returned HSQL uses case #2 and therefore the maxResults has to be altered based on the firstResultIndex.- Overrides:
computeMaxRowsForSQLin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- See Also:
MySQLPlatform
-
printSQLSelectStatement
public void printSQLSelectStatement(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter printer, org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)Print the pagination SQL using HSQL syntax "SELECT LIMIT <first> <max>".- Overrides:
printSQLSelectStatementin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform
-
getTimestampQuery
public ValueReadQuery getTimestampQuery()
Description copied from class:org.eclipse.persistence.internal.databaseaccess.DatasourcePlatformThis method can be overridden by subclasses to return a query that will return the timestamp from the server. return null if the time should be the local time.- Specified by:
getTimestampQueryin interfaceorg.eclipse.persistence.internal.databaseaccess.Platform- Overrides:
getTimestampQueryin classorg.eclipse.persistence.internal.databaseaccess.DatasourcePlatform
-
buildSequenceObjectCreationWriter
public Writer buildSequenceObjectCreationWriter(Writer writer, String fullSeqName, int increment, int start) throws IOException
INTERNAL: HSQL requires START WITH first.- Overrides:
buildSequenceObjectCreationWriterin classorg.eclipse.persistence.internal.databaseaccess.DatabasePlatform- Throws:
IOException
-
-