Top Description Fields Constructors Methods
org.eclipse.persistence.internal.databaseaccess

public abstract Class DatabaseCall

extends DatasourceCall
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.queries.SQLCall, org.eclipse.persistence.queries.StoredProcedureCall
Imports
java.io.IOException, .StringWriter, .Writer, java.sql.Array, .CallableStatement, .PreparedStatement, .ResultSet, .SQLException, .Statement, .Struct, java.util.ArrayList, .Collection, .Iterator, .List, .Vector, java.util.concurrent.TimeUnit, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.QueryException, .ValidationException, org.eclipse.persistence.internal.expressions.ParameterExpression, org.eclipse.persistence.internal.helper.DatabaseField, .Helper, org.eclipse.persistence.internal.queries.CallQueryMechanism, .DatabaseQueryMechanism, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.structures.ObjectRelationalDataTypeDescriptor, .ObjectRelationalDatabaseField, org.eclipse.persistence.queries.DatabaseQuery, .ModifyQuery, .ReadObjectQuery, org.eclipse.persistence.sessions.DatabaseRecord

INTERNAL: Purpose: Used as an abstraction of a database invocation. A call is an SQL string or procedure call with parameters.

Field Summary

Modifier and TypeField and Description
private transient AbstractRecord
protected boolean
executeReturnValue

JPA 2.1 NamedStoredProcedureQuery execute API implementation.

protected transient Vector<DatabaseField>
protected transient DatabaseField[]
protected int
public static final DatabaseField
protected transient ResultSet
protected boolean
hasAllocatedConnection

Indicates whether the call has allocated connection.

protected boolean
hasMultipleResultSets

Support multiple result sets.

protected boolean
protected boolean
ignoreFirstRowSetting

Indicates if the FirstRow value in this call object is to be ignored.

protected boolean
ignoreMaxResultsSetting

Indicates if the MaxResults value in this call object is to be ignored.

protected boolean
isBatchExecutionSupported

Define if this query is compatible with batch writing.

protected boolean
protected boolean
isCursorOutputProcedure

Allow for a single cursored output parameter.

protected boolean
protected boolean
isMultipleCursorOutputProcedure

Allow for multiple cursored output parameter.

protected boolean
public static final DatabaseField
MAXROW_FIELD

Following fields are used to bind MaxResults and FirstRow settings into the query instead of using the values stored in the call.

protected int
protected int
protected TimeUnit
protected transient ResultSet
protected int
protected int
protected int
protected boolean
returnMultipleResultSetCollections

Support returning multiple results sets instead of just one list, i.e. support multiple results set mappings.

protected Boolean
protected boolean
protected Boolean
protected boolean
protected String
sqlString

The SQL string to execute.

protected transient Statement
protected Boolean
Inherited from org.eclipse.persistence.internal.databaseaccess.DatasourceCall:
EXECUTE_UPDATEisNativeConnectionRequiredisPreparedNO_RETURNoutputCursorsparameterBindingsparametersparameterTypesqueryRETURN_CURSORRETURN_MANY_ROWSRETURN_ONE_ROWreturnTypeshouldProcessTokenInQuotes

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
addContext(DatabaseField field, Object value)

INTERNAL: Add a field - value pair for LOB field into the context.

public static void
appendLogParameters(Collection<E> parameters, Accessor accessor, StringWriter writer, AbstractSession session)

Print the parameters to the write for logging purposes.

public void
appendParameter(Writer writer, Object parameter, boolean shouldBind, AbstractSession session)

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourceCall.appendParameter.

Add the parameter.
public void
bindParameter(Writer writer, Object parameter)

Bind the parameter.

public DatabaseQueryMechanism
public AbstractRecord
buildOutputRow(CallableStatement statement, DatabaseAccessor accessor, AbstractSession session)

INTERNAL: Return Record containing output fields and values.

public DatabaseQueryMechanism
protected Object
public String
getCallString()

INTERNAL: Return the SQL string for the call.

public AbstractRecord
getContexts()

INTERNAL: Return the contexts (for LOB)

public int
getCursorOutIndex()

INTERNAL: Return 1-based index of out cursor parameter, or -1.

public boolean
getExecuteReturnValue()

After an execute call the return value can be retrieved here.

public Vector<DatabaseField>
getFields()

The fields expected by the calls result set.

public DatabaseField[]
getFieldsArray()

INTERNAL: The array of fields returned by the call.

protected DatabaseField
getFieldWithTypeFromDescriptor(DatabaseField outField)

INTERNAL: Unfortunately can't avoid referencing query and descriptor: the call should be performed after the translateCustomSQL (in SQLCall) in the middle of prepare method (no parameter available earlier).

public int
getFirstResult()

get first result

public ResultSet
getGeneratedKeys()

The result set that stores the generated keys from the Statement

public String
public int
getMaxRows()

get max rows returned from the call

public Object
getOutputParameterValue(CallableStatement
SQL/JDBC statement to call stored procedure/function
statement
,
int
0-based index in the argument list
index
,
AbstractSession
Active database session (in connected state).
session
)

INTERNAL: Get the return object from the statement.

public Object
getOutputParameterValue(CallableStatement
SQL/JDBC statement to call stored procedure/function
statement
,
String
parameter name
name
,
AbstractSession
Active database session (in connected state).
session
)

INTERNAL: Get the return object from the statement.

public Vector<E>
getOutputRowFields()

INTERNAL Returns the fields to be used in output row.

public String
getQueryString()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourceCall.getQueryString.

INTERNAL: Return the query string (SQL) of the call.
public int
getQueryTimeout()

Get timeout limit from the call

public ResultSet
getResult()

The result set is stored for the return value of cursor selects.

public int
public int
public int
public boolean
getReturnsResultSet()

ADVANCED: This method returns a value that represents if the customer has set whether or not EclipseLink should expect the stored procedure to returning a JDBC ResultSet.

public String
getSQLString()

Return the SQL string that will be executed.

public Statement
getStatement()

The statement is stored for the return value of cursor selects.

public boolean
public boolean
hasMultipleResultSets()

Return if the call returns multiple result sets.

public boolean
hasOptimisticLock()

This check is needed only when doing batch writing.

public boolean
isBatchExecutionSupported()

INTERNAL: Return if this query is compatible with batch writing.

protected boolean
isCallableStatementRequired()

Callable statement is required if there is an output parameter.

public boolean
isCursorOutputProcedure()

Used for Oracle result sets through procedures.

public boolean
isCursorReturned()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourceCall.isCursorReturned.

The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.
protected boolean
isDynamicCall(AbstractSession session)

Return if the call is dynamic SQL call.

public boolean
isFieldMatchingRequired()

Return if field matching is required.

public boolean
isFinished()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourceCall.isFinished.

Implements org.eclipse.persistence.queries.Call.isFinished.

Return whether all the results of the call have been returned.
public boolean
isLOBLocatorNeeded()

INTERNAL: Return if the locator is required for the LOB (BLOB and CLOB) writing.

public boolean
isMultipleCursorOutputProcedure()

Used for Oracle result sets through procedures.

public boolean
isNonCursorOutputProcedure()

Return true for procedures with any output (or in/out) parameters and no cursors

public boolean
public void
matchFieldOrder(ResultSet resultSet, DatabaseAccessor accessor, AbstractSession session)

Allow for the field order to be matched if required.

public void
prepare(AbstractSession session)

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourceCall.prepare.

INTERNAL: Allow pre-printing of the SQL string for fully bound calls, to save from reprinting.
protected void
prepareInternal(AbstractSession session)

INTERNAL: Called by prepare method only.

protected void
prepareInternalParameters(AbstractSession session)

INTERNAL: Called by prepareInternal method only.

public Statement
prepareStatement(DatabaseAccessor accessor, AbstractRecord translationRow, AbstractSession session)

INTERNAL: Prepare the JDBC statement, this may be parameterize or a call statement.

public boolean
returnMultipleResultSetCollections()

Return true if the multiple results 'lists' should be returned.

public void
setBatchExecutionSupported(boolean isBatchExecutionSupported)

INTERNAL: Set if this query is compatible with batch writing.

public void
setContexts(AbstractRecord contexts)

INTERNAL: Set the contexts (for LOB)

public void
setExecuteReturnValue(boolean value)

An execute return value will be set here after the call.

public void
setFields(Vector<DatabaseField> fields)

The fields expected by the calls result set.

public void
setFirstResult(int firstResult)

The firstResult set on the result set

public void
setGeneratedKeys(ResultSet generatedKeys)

The result set that stores the generated keys from the Statement

public void
setHasAllocatedConnection(boolean hasAllocatedConnection)

INTERNAL:

public void
setHasMultipleResultSets(boolean hasMultipleResultSets)

Set if the call returns multiple result sets.

public void
setHasOptimisticLock(boolean hasOptimisticLock)

This check is needed only when doing batch writing and we hit on optimistic locking.

public void
setIgnoreFirstRowSetting(boolean ignoreFirstRowSetting)

INTERNAL: Sets the ignoreFirstRowSetting flag.

public void
setIgnoreMaxResultsSetting(boolean ignoreMaxResultsSetting)

INTERNAL: Sets the ignoreMaxResultsSetting flag.

protected void
setIsCallableStatementRequired(boolean isCallableStatementRequired)

Callable statement is required if there is an output parameter.

public void
setIsCursorOutputProcedure(boolean isCursorOutputProcedure)

Used for Oracle result sets through procedures.

public void
setIsFieldMatchingRequired(boolean isFieldMatchingRequired)

Field matching is required for custom SQL statements where the result set field order is not known.

public void
setIsMultipleCursorOutputProcedure(boolean isMultipleCursorOutputProcedure)

Used for Oracle result sets through procedures.

public void
setIsResultSetScrollable(boolean isResultSetScrollable)

public void
setMaxRows(int maxRows)

set query max returned row size to the JDBC Statement

public void
setQueryString(String queryString)

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourceCall.setQueryString.

INTERNAL: Set the query string (SQL) of the call.
public void
setQueryTimeout(int queryTimeout)

set query timeout limit to the JDBC Statement

public void
setQueryTimeoutUnit(TimeUnit queryTimeoutUnit)

set query timeout limit unit to the JDBC Statement

public void
setResult(ResultSet result)

The result set is stored for the return value of cursor selects.

public void
setResultSetConcurrency(int resultSetConcurrency)

public void
setResultSetFetchSize(int resultSetFetchSize)

public void
setResultSetType(int resultSetType)

public void
setReturnMultipleResultSetCollections(boolean returnMultipleResultSetCollections)

Set if the call returns multiple result sets.

public void
setReturnsResultSet(boolean returnsResultSet)

PUBLIC: Use this method to tell EclipseLink that the stored procedure will be returning a JDBC ResultSet

protected void
setShouldBuildOutputRow(boolean shouldBuildOutputRow)

INTERNAL: Set whether the call has to build output row

public void
setShouldCacheStatement(boolean shouldCacheStatement)

Bound calls can use prepared statement caching.

public boolean
setShouldReturnGeneratedKeys(boolean shouldReturnGeneratedKeys)

Indicate that this call should set java.sql.Statement#RETURN_GENERATED_KEYS when executing

Only set to true if DatabasePlatform#supportsReturnGeneratedKeys()

protected void
setSQLStringInternal(String sqlString)

INTERNAL: Set the SQL string.

public void
setStatement(Statement statement)

The statement is stored for the return value of cursor selects.

public boolean
shouldBuildOutputRow()

Set whether the call has to build output row

public boolean
shouldCacheStatement(AbstractSession session)

Bound calls can use prepared statement caching.

public boolean
shouldCacheStatement(DatabasePlatform databasePlatform)

Bound calls can use prepared statement caching.

public boolean
shouldIgnoreFirstRowSetting()

INTERNAL: Returns the ignoreFirstRowSetting flag.

public boolean
shouldIgnoreMaxResultsSetting()

INTERNAL: Returns the ignoreMaxResultsSetting flag.

public boolean
shouldReturnGeneratedKeys()

Indicate that this call should set java.sql.Statement#RETURN_GENERATED_KEYS when executing

public String
toString()

Overrides java.lang.Object.toString.

INTERNAL: Print the SQL string.
public void
translate(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session)

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourceCall.translate.

INTERNAL: Allow the call to translate from the translation for predefined calls.
public void
useUnnamedCursorOutputAsResultSet()

PUBLIC: Used for Oracle result sets through procedures.

Inherited from org.eclipse.persistence.internal.databaseaccess.DatasourceCall:
appendInappendInappendInappendInOutappendInOutappendInOutappendInOutappendInOutappendLiteralappendLiteralappendLiteralappendModifyappendModifyappendModifyappendOutappendOutappendOutappendOutCursorappendOutCursorappendTranslationappendTranslationappendTranslationareManyRowsReturnedargumentMarkerclonecreateFieldgetOutputCursorsgetParameterBindingsgetParametersgetParameterTypesgetQuerygetReturnTypegetValueForInOutParametergetValueForInParameterhasOutputCursorshasParametersisEISInteractionisExecuteUpdateisJPQLCallisNativeConnectionRequiredisNothingReturnedisOneRowReturnedisOutputParameterTypeisPreparedisQueryStringCallisReturnSetisSQLCallisStoredFunctionCallisStoredPLSQLFunctionCallisStoredPLSQLProcedureCallisStoredProcedureCallisUsesBindingSetreturnCursorreturnManyRowsreturnNothingreturnOneRowsetExecuteUpdatesetIsNativeConnectionRequiredsetIsPreparedsetParameterBindingssetParameterssetParameterTypessetQuerysetReturnTypesetUsesBindingtranslateCustomQuerytranslatePureSQLCustomQuerytranslateQueryStringtranslateQueryStringAndBindParameterstranslateQueryStringForParameterizedINusesBindingusesBindingusesBindingwhitespace