public class

Oracle8iDialect

extends Dialect
java.lang.Object
   ↳ org.hibernate.dialect.Dialect
     ↳ org.hibernate.dialect.Oracle8iDialect
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

A dialect for Oracle 8i.

Summary

Constants
String DEPRECATED_ORACLE_TYPES_CLASS_NAME
int INIT_ORACLETYPES_CURSOR_VALUE
String ORACLE_TYPES_CLASS_NAME
[Expand]
Inherited Constants
From class org.hibernate.dialect.Dialect
Public Constructors
Oracle8iDialect()
Public Methods
boolean bindLimitParametersInReverseOrder()
ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit.
CaseFragment createCaseFragment()
Map case support to the Oracle DECODE function.
JoinFragment createOuterJoinFragment()
Support for the oracle proprietary join syntax...
boolean dropConstraints()
Do we need to drop constraints before dropping tables in this dialect?
boolean dropTemporaryTableAfterUse()
Do we need to drop the temporary table after use?
boolean forUpdateOfColumns()
Is FOR UPDATE OF syntax supported?
String generateTemporaryTableName(String baseTableName)
Generate a temporary table name given the base table.
String getAddColumnString()
The syntax used to add a column to a table (optional).
String getBasicSelectClauseNullString(int sqlType)
Allows access to the basic getSelectClauseNullString(int) implementation...
String getCascadeConstraintsString()
Completely optional cascading drop clause
String getCreateSequenceString(String sequenceName)
Typically dialects which support sequences can create a sequence with a single command.
String getCreateTemporaryTablePostfix()
Get any fragments needing to be postfixed to the command for temporary table creation.
String getCreateTemporaryTableString()
Command used to create a temporary table.
String getCrossJoinSeparator()
Get the separator to use for defining cross joins when translating HQL queries.
String getCurrentTimestampSQLFunctionName()
The name of the database-specific SQL function for retrieving the current timestamp.
String getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestamp from the database.
String getDropSequenceString(String sequenceName)
Typically dialects which support sequences can drop a sequence with a single command.
String getForUpdateNowaitString()
Retrieves the FOR UPDATE NOWAIT syntax specific to this dialect.
String getForUpdateNowaitString(String aliases)
Get the FOR UPDATE OF column_list NOWAIT fragment appropriate for this dialect given the aliases of the columns to be write locked.
String getForUpdateString(String aliases)
Get the FOR UPDATE OF column_list fragment appropriate for this dialect given the aliases of the columns to be write locked.
String getLimitString(String sql, boolean hasOffset)
Apply s limit clause to the query.
int getOracleCursorTypeSqlType()
String getQuerySequencesString()
Get the select command used retrieve the names of all sequences.
ResultSet getResultSet(CallableStatement ps)
Given a callable statement previously processed by registerResultSetOutParameter(CallableStatement, int), extract the ResultSet from the OUT parameter.
String getSelectClauseNullString(int sqlType)
Given a java.sql.Types type code, determine an appropriate null value to use in a select clause.
String getSelectGUIDString()
Get the command used to select a GUID from the underlying database.
String getSelectSequenceNextValString(String sequenceName)
Generate the select expression fragment that will retrieve the next value of a sequence as part of another (typically DML) statement.
String getSequenceNextValString(String sequenceName)
Generate the appropriate select statement to to retrieve the next value of a sequence.
ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter()
boolean isCurrentTimestampSelectStringCallable()
Should the value returned by getCurrentTimestampSelectString() be treated as callable.
int registerResultSetOutParameter(CallableStatement statement, int col)
Registers an OUT parameter which will be returning a ResultSet.
boolean supportsCommentOn()
boolean supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database's current timestamp value?
boolean supportsEmptyInList()
Does this dialect support empty IN lists?

For example, is [where XYZ in ()] a supported construct?

boolean supportsExistsInSelect()
Does the dialect support an exists statement in the select clause?
boolean supportsLimit()
Does this dialect support some form of limiting query results via a SQL clause?
boolean supportsPooledSequences()
Does this dialect support "pooled" sequences.
boolean supportsSequences()
Does this dialect support sequences?
boolean supportsTemporaryTables()
Does this dialect support temporary tables?
boolean supportsUnionAll()
Does this dialect support UNION ALL, which is generally a faster variant of UNION?
boolean useMaxForLimit()
Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows?

This is easiest understood via an example.

Protected Methods
int extractOracleCursorTypeValue()
void registerCharacterTypeMappings()
void registerDateTimeTypeMappings()
void registerDefaultProperties()
void registerFunctions()
void registerLargeObjectTypeMappings()
void registerNumericTypeMappings()
void registerReverseHibernateTypeMappings()
[Expand]
Inherited Methods
From class org.hibernate.dialect.Dialect
From class java.lang.Object

Constants

public static final String DEPRECATED_ORACLE_TYPES_CLASS_NAME

Constant Value: "oracle.jdbc.driver.OracleTypes"

public static final int INIT_ORACLETYPES_CURSOR_VALUE

Constant Value: -99 (0xffffff9d)

public static final String ORACLE_TYPES_CLASS_NAME

Constant Value: "oracle.jdbc.OracleTypes"

Public Constructors

public Oracle8iDialect ()

Public Methods

public boolean bindLimitParametersInReverseOrder ()

ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. Does this dialect require us to bind the parameters in reverse order?

Returns
  • true if the correct order is limit, offset

public CaseFragment createCaseFragment ()

Map case support to the Oracle DECODE function. Oracle did not add support for CASE until 9i.

Returns
  • The oracle CASE -> DECODE fragment

public JoinFragment createOuterJoinFragment ()

Support for the oracle proprietary join syntax...

Returns
  • The orqacle join fragment

public boolean dropConstraints ()

Do we need to drop constraints before dropping tables in this dialect?

Returns
  • True if constraints must be dropped prior to dropping the table; false otherwise.

public boolean dropTemporaryTableAfterUse ()

Do we need to drop the temporary table after use?

Returns
  • True if the table should be dropped.

public boolean forUpdateOfColumns ()

Is FOR UPDATE OF syntax supported?

Returns
  • True if the database supports FOR UPDATE OF syntax; false otherwise.

public String generateTemporaryTableName (String baseTableName)

Generate a temporary table name given the base table.

Parameters
baseTableName The table name from which to base the temp table name.
Returns
  • The generated temp table name.

public String getAddColumnString ()

The syntax used to add a column to a table (optional).

Returns
  • The "add column" fragment.

public String getBasicSelectClauseNullString (int sqlType)

Allows access to the basic getSelectClauseNullString(int) implementation...

Parameters
sqlType The java.sql.Types mapping type code
Returns
  • The appropriate select cluse fragment

public String getCascadeConstraintsString ()

Completely optional cascading drop clause

Returns
  • String

public String getCreateSequenceString (String sequenceName)

Typically dialects which support sequences can create a sequence with a single command. This is convenience form of getCreateSequenceStrings(String) to help facilitate that.

Dialects which support sequences and can create a sequence in a single command need *only* override this method. Dialects which support sequences but require multiple commands to create a sequence should instead override getCreateSequenceStrings(String).

Parameters
sequenceName The name of the sequence
Returns
  • The sequence creation command

public String getCreateTemporaryTablePostfix ()

Get any fragments needing to be postfixed to the command for temporary table creation.

Returns
  • Any required postfix.

public String getCreateTemporaryTableString ()

Command used to create a temporary table.

Returns
  • The command used to create a temporary table.

public String getCrossJoinSeparator ()

Get the separator to use for defining cross joins when translating HQL queries.

Typically this will be either [ cross join ] or [, ]

Note that the spaces are important!

public String getCurrentTimestampSQLFunctionName ()

The name of the database-specific SQL function for retrieving the current timestamp.

Returns
  • The function name.

public String getCurrentTimestampSelectString ()

Retrieve the command used to retrieve the current timestamp from the database.

Returns
  • The command.

public String getDropSequenceString (String sequenceName)

Typically dialects which support sequences can drop a sequence with a single command. This is convenience form of getDropSequenceStrings(String) to help facilitate that.

Dialects which support sequences and can drop a sequence in a single command need *only* override this method. Dialects which support sequences but require multiple commands to drop a sequence should instead override getDropSequenceStrings(String).

Parameters
sequenceName The name of the sequence
Returns
  • The sequence drop commands

public String getForUpdateNowaitString ()

Retrieves the FOR UPDATE NOWAIT syntax specific to this dialect.

Returns
  • The appropriate FOR UPDATE NOWAIT clause string.

public String getForUpdateNowaitString (String aliases)

Get the FOR UPDATE OF column_list NOWAIT fragment appropriate for this dialect given the aliases of the columns to be write locked.

Parameters
aliases The columns to be write locked.
Returns
  • The appropriate FOR UPDATE colunm_list NOWAIT clause string.

public String getForUpdateString (String aliases)

Get the FOR UPDATE OF column_list fragment appropriate for this dialect given the aliases of the columns to be write locked.

Parameters
aliases The columns to be write locked.
Returns
  • The appropriate FOR UPDATE OF column_list clause string.

public String getLimitString (String sql, boolean hasOffset)

Apply s limit clause to the query.

Typically dialects utilize variable limit clauses when they support limits. Thus, when building the select command we do not actually need to know the limit or the offest since we will just be using placeholders.

Here we do still pass along whether or not an offset was specified so that dialects not supporting offsets can generate proper exceptions. In general, dialects will override one or the other of this method and getLimitString(String, int, int).

Parameters
sql The query to which to apply the limit.
hasOffset Is the query requesting an offset?
Returns
  • the modified SQL

public int getOracleCursorTypeSqlType ()

public String getQuerySequencesString ()

Get the select command used retrieve the names of all sequences.

Returns
  • The select command; or null if sequences are not supported.

public ResultSet getResultSet (CallableStatement ps)

Given a callable statement previously processed by registerResultSetOutParameter(CallableStatement, int), extract the ResultSet from the OUT parameter.

Parameters
ps The callable statement.
Returns
  • The extracted result set.
Throws
SQLException

public String getSelectClauseNullString (int sqlType)

Given a java.sql.Types type code, determine an appropriate null value to use in a select clause.

One thing to consider here is that certain databases might require proper casting for the nulls here since the select here will be part of a UNION/UNION ALL.

Parameters
sqlType The java.sql.Types type code.
Returns
  • The appropriate select clause value fragment.

public String getSelectGUIDString ()

Get the command used to select a GUID from the underlying database.

Optional operation.

Returns
  • The appropriate command.

public String getSelectSequenceNextValString (String sequenceName)

Generate the select expression fragment that will retrieve the next value of a sequence as part of another (typically DML) statement.

This differs from getSequenceNextValString(String) in that this should return an expression usable within another statement.

Parameters
sequenceName the name of the sequence
Returns
  • The "nextval" fragment.

public String getSequenceNextValString (String sequenceName)

Generate the appropriate select statement to to retrieve the next value of a sequence.

This should be a "stand alone" select statement.

Parameters
sequenceName the name of the sequence
Returns
  • String The "nextval" select string.

public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter ()

public boolean isCurrentTimestampSelectStringCallable ()

Should the value returned by getCurrentTimestampSelectString() be treated as callable. Typically this indicates that JDBC escape syntax is being used...

Returns

public int registerResultSetOutParameter (CallableStatement statement, int col)

Registers an OUT parameter which will be returning a ResultSet. How this is accomplished varies greatly from DB to DB, hence its inclusion (along with getResultSet(CallableStatement)) here.

Parameters
statement The callable statement.
col The bind position at which to register the OUT param.
Returns
  • The number of (contiguous) bind positions used.
Throws
SQLException

public boolean supportsCommentOn ()

public boolean supportsCurrentTimestampSelection ()

Does this dialect support a way to retrieve the database's current timestamp value?

Returns
  • True if the current timestamp can be retrieved; false otherwise.

public boolean supportsEmptyInList ()

Does this dialect support empty IN lists?

For example, is [where XYZ in ()] a supported construct?

Returns
  • True if empty in lists are supported; false otherwise.

public boolean supportsExistsInSelect ()

Does the dialect support an exists statement in the select clause?

Returns
  • True if exists checks are allowed in the select clause; false otherwise.

public boolean supportsLimit ()

Does this dialect support some form of limiting query results via a SQL clause?

Returns
  • True if this dialect supports some form of LIMIT.

public boolean supportsPooledSequences ()

Does this dialect support "pooled" sequences. Not aware of a better name for this. Essentially can we specify the initial and increment values?

Returns
  • True if such "pooled" sequences are supported; false otherwise.

public boolean supportsSequences ()

Does this dialect support sequences?

Returns
  • True if sequences supported; false otherwise.

public boolean supportsTemporaryTables ()

Does this dialect support temporary tables?

Returns
  • True if temp tables are supported; false otherwise.

public boolean supportsUnionAll ()

Does this dialect support UNION ALL, which is generally a faster variant of UNION?

Returns
  • True if UNION ALL is supported; false otherwise.

public boolean useMaxForLimit ()

Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows?

This is easiest understood via an example. Consider you have a table with 20 rows, but you only want to retrieve rows number 11 through 20. Generally, a limit with offset would say that the offset = 11 and the limit = 10 (we only want 10 rows at a time); this is specifying the total number of returned rows. Some dialects require that we instead specify offset = 11 and limit = 20, where 20 is the "last" row we want relative to offset (i.e. total number of rows = 20 - 11 = 9)

So essentially, is limit relative from offset? Or is limit absolute?

Returns
  • True if limit is relative from offset; false otherwise.

Protected Methods

protected int extractOracleCursorTypeValue ()

protected void registerCharacterTypeMappings ()

protected void registerDateTimeTypeMappings ()

protected void registerDefaultProperties ()

protected void registerFunctions ()

protected void registerLargeObjectTypeMappings ()

protected void registerNumericTypeMappings ()

protected void registerReverseHibernateTypeMappings ()