Top Description Fields Constructors Methods
org.eclipse.persistence.queries

public Class SQLCall

extends DatabaseCall
implements QueryStringCall
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.databaseaccess.QueryStringCall, org.eclipse.persistence.queries.Call, java.io.Serializable, java.lang.Cloneable
Imports
java.util.List, java.io.*, org.eclipse.persistence.internal.databaseaccess.*, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.exceptions.ValidationException, org.eclipse.persistence.internal.expressions.ParameterExpression, org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

Purpose: Used as an abstraction of an SQL call. A call is an SQL string with parameters.

Field Summary

Modifier and TypeField and Description
protected boolean
protected transient boolean
Inherited from org.eclipse.persistence.internal.databaseaccess.DatabaseCall:
executeReturnValuefieldsfieldsArrayfirstResultFIRSTRESULT_FIELDgeneratedKeyshasAllocatedConnectionhasMultipleResultSetshasOptimisticLockignoreFirstRowSettingignoreMaxResultsSettingisBatchExecutionSupportedisCallableStatementRequiredisCursorOutputProcedureisFieldMatchingRequiredisMultipleCursorOutputProcedureisResultSetScrollableMAXROW_FIELDmaxRowsqueryTimeoutqueryTimeoutUnitresultresultSetConcurrencyresultSetFetchSizeresultSetTypereturnMultipleResultSetCollectionsreturnsResultSetshouldBuildOutputRowshouldCacheStatementshouldReturnGeneratedKeyssqlStringstatementusesBinding

Constructor Summary

AccessConstructor and Description
public
SQLCall()

PUBLIC: Create a new SQL call.

public
SQLCall(String sqlString)

PUBLIC: Create a new SQL call.

Method Summary

Modifier and TypeMethod and Description
protected void
afterTranslateCustomQuery(List<E> updatedParameters, List<DatasourceCall.ParameterType> updatedParameterTypes)

INTERNAL: Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods.

protected DatabaseField
afterTranslateCustomQueryUpdateParameter(DatabaseField field, int index, DatasourceCall.ParameterType parameterType, List<E> updatedParameters, List<DatasourceCall.ParameterType> updatedParameterTypes)

INTERNAL: Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods.

public void
appendTranslationParameter(Writer writer, ParameterExpression expression, DatabasePlatform platform, AbstractRecord record)

INTERNAL: All values are printed as ?

public boolean
hasCustomSQLArguments()

INTERNAL: Used to avoid misinterpreting the # in custom SQL.

public boolean
public boolean
protected void
public void
setCustomSQLArgumentType(String customParameterName, Class<?> type)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).

public void
setCustomSQLArgumentType(String argumentFieldName, int type)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).

public void
setCustomSQLArgumentType(String argumentFieldName, int type, String typeName)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).

public void
setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, Class<?> javaType)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).

public void
setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, DatabaseField nestedType)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).

public void
setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, Class<?> javaType, DatabaseField nestedType)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).

public void
setHasCustomSQLArguments(boolean hasCustomSQLArguments)

INTERNAL: Used to avoid misinterpreting the # in custom SQL.

public void
setSQLString(String sqlString)

Set the SQL string.

public void
public void
translatePureSQLCustomQuery()

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

INTERNAL: Only translate the call if it was not previously translated This code ensures the translation code for a custom SQLCall is only run once In the case of inheritance we will try to call the translation code once to get the list of types and again for each subclass
public void
useCustomSQLCursorOutputAsResultSet(String customParameterName)

PUBLIC: This method should only be used with custom SQL: Used for Oracle result sets through procedures.

Inherited from org.eclipse.persistence.internal.databaseaccess.DatabaseCall:
addContextappendLogParametersappendParameterbindParameterbuildNewQueryMechanismbuildOutputRowbuildQueryMechanismcreateInOutParametergetCallStringgetContextsgetCursorOutIndexgetExecuteReturnValuegetFieldsgetFieldsArraygetFieldWithTypeFromDescriptorgetFirstResultgetGeneratedKeysgetLogStringgetMaxRowsgetOutputParameterValuegetOutputParameterValuegetOutputRowFieldsgetQueryStringgetQueryTimeoutgetResultgetResultSetConcurrencygetResultSetFetchSizegetResultSetTypegetReturnsResultSetgetSQLStringgetStatementhasAllocatedConnectionhasMultipleResultSetshasOptimisticLockisBatchExecutionSupportedisCallableStatementRequiredisCursorOutputProcedureisCursorReturnedisDynamicCallisFieldMatchingRequiredisFinishedisLOBLocatorNeededisMultipleCursorOutputProcedureisNonCursorOutputProcedureisResultSetScrollablematchFieldOrderprepareprepareInternalParametersprepareStatementreturnMultipleResultSetCollectionssetBatchExecutionSupportedsetContextssetExecuteReturnValuesetFieldssetFirstResultsetGeneratedKeyssetHasAllocatedConnectionsetHasMultipleResultSetssetHasOptimisticLocksetIgnoreFirstRowSettingsetIgnoreMaxResultsSettingsetIsCallableStatementRequiredsetIsCursorOutputProceduresetIsFieldMatchingRequiredsetIsMultipleCursorOutputProceduresetIsResultSetScrollablesetMaxRowssetQueryStringsetQueryTimeoutsetQueryTimeoutUnitsetResultsetResultSetConcurrencysetResultSetFetchSizesetResultSetTypesetReturnMultipleResultSetCollectionssetReturnsResultSetsetShouldBuildOutputRowsetShouldCacheStatementsetShouldReturnGeneratedKeyssetSQLStringInternalsetStatementshouldBuildOutputRowshouldCacheStatementshouldCacheStatementshouldIgnoreFirstRowSettingshouldIgnoreMaxResultsSettingshouldReturnGeneratedKeystoStringtranslateuseUnnamedCursorOutputAsResultSet

Field Detail

hasCustomSQLArgumentsback to summary
protected boolean hasCustomSQLArguments
isTranslatedCustomQueryback to summary
protected transient boolean isTranslatedCustomQuery

Constructor Detail

SQLCallback to summary
public SQLCall()

PUBLIC: Create a new SQL call.

SQLCallback to summary
public SQLCall(String sqlString)

PUBLIC: Create a new SQL call.

Warning

Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.

Method Detail

afterTranslateCustomQueryback to summary
protected void afterTranslateCustomQuery(List<E> updatedParameters, List<DatasourceCall.ParameterType> updatedParameterTypes)

INTERNAL: Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods.

afterTranslateCustomQueryUpdateParameterback to summary
protected DatabaseField afterTranslateCustomQueryUpdateParameter(DatabaseField field, int index, DatasourceCall.ParameterType parameterType, List<E> updatedParameters, List<DatasourceCall.ParameterType> updatedParameterTypes)

INTERNAL: Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods. This will return the null if the user did not add the field/type using the setCustomSQLArgumentType method

appendTranslationParameterback to summary
public void appendTranslationParameter(Writer writer, ParameterExpression expression, DatabasePlatform platform, AbstractRecord record) throws IOException

INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.

hasCustomSQLArgumentsback to summary
public boolean hasCustomSQLArguments()

INTERNAL: Used to avoid misinterpreting the # in custom SQL.

isQueryStringCallback to summary
public boolean isQueryStringCall()

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

Implements org.eclipse.persistence.internal.databaseaccess.QueryStringCall.isQueryStringCall.

Doc from org.eclipse.persistence.internal.databaseaccess.QueryStringCall.isQueryStringCall.

Should return true.

Annotations
@Override
isSQLCallback to summary
public boolean isSQLCall()

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

Annotations
@Override
prepareInternalback to summary
protected void prepareInternal(AbstractSession session)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareInternal.

INTERNAL: Called by prepare method only.

Annotations
@Override
setCustomSQLArgumentTypeback to summary
public void setCustomSQLArgumentType(String customParameterName, Class<?> type)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).

setCustomSQLArgumentTypeback to summary
public void setCustomSQLArgumentType(String argumentFieldName, int type)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). The argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter.

setCustomSQLArgumentTypeback to summary
public void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). The argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter. The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types.

setCustomSQLArgumentTypeback to summary
public void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, Class<?> javaType)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). TThe argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter. The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types. The javaType is the java class to return instead of the ARRAY and STRUCT types if a conversion is possible.

setCustomSQLArgumentTypeback to summary
public void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, DatabaseField nestedType)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). TThe argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter. The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types. The nestedType is a DatabaseField with type information set to match the VARRAYs object types

setCustomSQLArgumentTypeback to summary
public void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, Class<?> javaType, DatabaseField nestedType)

PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). TThe argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter. The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types. The javaType is the java class to return instead of the ARRAY and STRUCT types if a conversion is possible. The nestedType is a DatabaseField with type information set to match the VARRAYs object types

setHasCustomSQLArgumentsback to summary
public void setHasCustomSQLArguments(boolean hasCustomSQLArguments)

INTERNAL: Used to avoid misinterpreting the # in custom SQL.

setSQLStringback to summary
public void setSQLString(String sqlString)

Set the SQL string.

Warning

Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.

translateCustomQueryback to summary
public void translateCustomQuery()

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

Implements org.eclipse.persistence.internal.databaseaccess.QueryStringCall.translateCustomQuery.

INTERNAL: Keep track of the fact that this call has been translated. This information is used to ensure the translation code for a custom SQLCall is only run once In the case of inheritance we will try to call the translation code once to get the list of types and again for each subclass

Annotations
@Override
translatePureSQLCustomQueryback to summary
public void translatePureSQLCustomQuery()

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

INTERNAL: Only translate the call if it was not previously translated This code ensures the translation code for a custom SQLCall is only run once In the case of inheritance we will try to call the translation code once to get the list of types and again for each subclass

Annotations
@Override
useCustomSQLCursorOutputAsResultSetback to summary
public void useCustomSQLCursorOutputAsResultSet(String customParameterName)

PUBLIC: This method should only be used with custom SQL: Used for Oracle result sets through procedures. It defines OUT parameter (prefixed with ### in custom SQL string) as a cursor output.