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

public Class DatasourcePlatform

extends Object
implements Platform
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.databaseaccess.Platform, java.lang.Cloneable, java.io.Serializable, org.eclipse.persistence.internal.core.databaseaccess.CorePlatform
Known Direct Subclasses
org.eclipse.persistence.eis.EISPlatform, org.eclipse.persistence.oxm.platform.XMLPlatform, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
Imports
java.io.IOException, .Writer, java.util.HashMap, .Hashtable, .Iterator, .List, .Map, .Set, org.eclipse.persistence.descriptors.DescriptorQueryManager, org.eclipse.persistence.exceptions.ConversionException, .ValidationException, org.eclipse.persistence.expressions.Expression, .ExpressionOperator, org.eclipse.persistence.internal.helper.ClassConstants, .ConversionManager, .DatabaseField, .Helper, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.queries.Call, .DataModifyQuery, .DatabaseQuery, .SQLCall, .ValueReadQuery, org.eclipse.persistence.sequencing.DefaultSequence, .QuerySequence, .Sequence, org.eclipse.persistence.sessions.Session

DatasourcePlatform is private to TopLink. It encapsulates behavior specific to a datasource platform (eg. Oracle, Sybase, DB2, Attunity, MQSeries), and provides protocol for TopLink to access this behavior.
Since
OracleAS TopLink 10g (10.0.3)
See Also
DatabasePlatform, org.eclipse.persistence.eis.EISPlatform

Field Summary

Modifier and TypeField and Description
protected transient ConversionManager
conversionManager

Allow for conversion to be customized in the platform.

protected Hashtable<Class<?>, List<Class<?>>>
dataTypesConvertedFromAClass

Store the list of Classes that can be converted to from the key.

protected Hashtable<Class<?>, List<Class<?>>>
dataTypesConvertedToAClass

Store the list of Classes that can be converted from to the key.

protected boolean
defaultNativeSequenceToTable

If the native sequence type is not supported, if table sequencing should be used.

protected boolean
defaultSeqenceAtNextValue

If sequences should start at Next Value

protected Sequence
defaultSequence

Store default sequence

protected String
protected transient Map<Integer, ExpressionOperator>
platformOperators

Operators specific to this platform

protected Map<String, Sequence>
sequences

Store map of sequence names to sequences

protected Object
sequencesLock

Ensures that only one thread at a time can add/remove sequences

protected String
startDelimiter

Delimiter to use for fields and tables using spaces or other special values

protected boolean
supportsReturnGeneratedKeys

This property configures if the database platform will use java.sql.Statement#getGeneratedKeys(), or a separate query, in order to obtain javax.persistence.GenerationType.IDENTITY generated values.

protected String
tableQualifier

Supporting name scopes in database by prefixing the table names with the table qualifier/creator.

protected ValueReadQuery
timestampQuery

Store the query use to query the current server time.

protected ValueReadQuery
uuidQuery

Store the query use to query the current server UUID.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
public void
addSequence(Sequence sequence)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.addSequence.

Add sequence corresponding to the name
public void
addSequence(Sequence sequence, boolean isSessionConnected)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.addSequence.

Add sequence corresponding to the name.
public void
public DatasourceCall
buildNativeCall(String queryString)

INTERNAL: Return the correct call type for the native query string.

public ValueReadQuery
buildSelectQueryForIdentity()

INTERNAL: Returns query used to read back the value generated by Identity.

public ValueReadQuery
buildSelectQueryForIdentity(String seqName, Integer size)

INTERNAL: Returns query used to read back the value generated by Identity.

public ValueReadQuery
buildSelectQueryForSequenceObject()

INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence).

public ValueReadQuery
buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size)

INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence).

public Object
clone()

Overrides java.lang.Object.clone.

Implements org.eclipse.persistence.internal.databaseaccess.Platform.clone.

Creates and returns a copy of this object.
public <T> T

Returns:

the newly converted object
convertObject
(Object
the object that must be converted
sourceObject
,
Class<T>
the class that the object must be converted to
javaClass
)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.convertObject.

Convert the object to the appropriate type by invoking the appropriate ConversionManager method
public void
copyInto(Platform platform)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.copyInto.

Copy the state into the new platform.
public ConnectionCustomizer
public Expression

Returns:

An expression for the given field set equal to a parameter matching the field
createExpressionFor
(DatabaseField field, Expression builder, String fieldClassificationClassName)

INTERNAL: Override this method if the platform needs to use a custom function based on the DatabaseField

protected Sequence
createPlatformDefaultSequence()

INTERNAL: Create platform-default Sequence

public ConversionManager
getConversionManager()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getConversionManager.

The platform hold its own instance of conversion manager to allow customization.
public Object
getCustomModifyValueForCall(Call call, Object value, DatabaseField field, boolean shouldBind)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getCustomModifyValueForCall.

Allow for the platform to handle the representation of parameters specially.
public List<Class<?>>

Returns:

- a vector of classes
getDataTypesConvertedFrom
(Class<?>
- the class that is converted from
javaClass
)

PUBLIC: Return the list of Classes that can be converted to from the passed in javaClass.

public List<Class<?>>

Returns:

- a vector of classes
getDataTypesConvertedTo
(Class<?>
- the class that is converted to
javaClass
)

PUBLIC: Return the list of Classes that can be converted from to the passed in javaClass.

public boolean
getDefaultNativeSequenceToTable()

Return if the native sequence type is not supported, if table sequencing should be used.

public boolean
getDefaultSeqenceAtNextValue()

Return if the sequence generation should start at next value.

public Sequence
public Sequence
public String
public String
getEndDelimiter()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getEndDelimiter.

Delimiter to use for fields and tables using spaces or other special values.
public int
getINClauseLimit()

INTERNAL: Some database platforms have a limit for the number of parameters in an IN clause.

public ExpressionOperator
getOperator(int selector)

Return the operator for the operator constant defined in ExpressionOperator.

public Map<Integer, ExpressionOperator>
getPlatformOperators()

Return any platform-specific operators

public ValueReadQuery
getSelectSequenceQuery()

OBSOLETE: This method lazy initializes the select sequence number query.

public Sequence
getSequence(String seqName)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getSequence.

Get sequence corresponding to the name
public int
public Map<String, Sequence>
getSequences()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getSequences.

INTERNAL: Returns a map of sequence names to Sequences (may be null).
public Map<String, Sequence>
getSequencesToWrite()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getSequencesToWrite.

INTERNAL: Used only for writing into XML or Java.
public String
getStartDelimiter()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getStartDelimiter.

Delimiter to use for fields and tables using spaces or other special values.
public String
public Timestamp
public ValueReadQuery
getTimestampQuery()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getTimestampQuery.

This method can be overridden by subclasses to return a query that will return the timestamp from the server.
public DataModifyQuery
getUpdateSequenceQuery()

OBSOLETE: This method lazy initializes the update sequence number query.

public ValueReadQuery
getUUIDQuery()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getUUIDQuery.

This method can be overridden by subclasses to return a query that will return the UUID from the server.
public boolean
hasDefaultSequence()

Get default sequence

public void
initialize()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.initialize.

Allow the platform to initialize itself after login/init.
public void
initializeDefaultQueries(DescriptorQueryManager queryManager, AbstractSession session)

INTERNAL: Allow the platform to initialize the CRUD queries to defaults.

protected void
initializePlatformOperators()

Initialize any platform-specific operators

public void
initIdentitySequences(final Session
Active database session (in connected state).
session
,
final String
Default identity generator sequence name.
defaultIdentityGenerator
)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.initIdentitySequences.

INTERNAL: Initialize platform specific identity sequences.
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public void
public void
removeIdentitySequences(final Session
Active database session (in connected state).
session
,
final String
Default identity generator sequence name.
defaultIdentityGenerator
,
final Set<String>
Set of table names to check for identity sequence removal.
tableNames
)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.removeIdentitySequences.

INTERNAL: Remove platform specific identity sequences for specified tables.
public Sequence
removeSequence(String seqName)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.removeSequence.

Remove sequence corresponding to name.
protected void
public void
setConversionManager(ConversionManager conversionManager)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.setConversionManager.

The platform hold its own instance of conversion manager to allow customization.
public void
setDefaultNativeSequenceToTable(boolean defaultNativeSequenceToTable)

Set if the native sequence type is not supported, if table sequencing should be used.

public void
setDefaultSeqenceAtNextValue(boolean defaultSeqenceAtNextValue)

Set if the sequence generation should start at next value.

public void
public void
setEndDelimiter(String endDelimiter)

Delimiter to use for fields and tables using spaces or other special values.

public void
setSelectSequenceNumberQuery(ValueReadQuery seqQuery)

OBSOLETE: Can override the default query for returning the sequence numbers.

public void
setSequencePreallocationSize(int size)

Set the number of sequence values to preallocate.

public void
setSequences(Map<String, Sequence> sequences)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.setSequences.

INTERNAL: Sets sequences - for XML support only
public void
setStartDelimiter(String startDelimiter)

Delimiter to use for fields and tables using spaces or other special values.

public void
setSupportsReturnGeneratedKeys(boolean supportsReturnGeneratedKeys)

Indicates whether the platform supports the use of java.sql.Statement#RETURN_GENERATED_KEYS.

public void
public void
setTimestampQuery(ValueReadQuery tsQuery)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.setTimestampQuery.

Can override the default query for returning a timestamp from the server.
public void
setUpdateSequenceQuery(DataModifyQuery updateSequenceNumberQuery)

This method sets the update sequence number query.

public void
setUUIDQuery(ValueReadQuery uuidQuery)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.setUUIDQuery.

Can override the default query for returning a UUID from the server.
public boolean
shouldNativeSequenceUseTransaction()

INTERNAL: Indicates whether a separate transaction is required for NativeSequence.

public boolean
shouldPrepare(DatabaseQuery query)

Allows query prepare to be disable in the platform.

public boolean
shouldSelectDistinctIncludeOrderBy()

Return if the database requires the ORDER BY fields to be part of the select clause.

public boolean
shouldSelectIncludeOrderBy()

Return if the database requires the ORDER BY fields to be part of the select clause.

public boolean
shouldUseCustomModifyForCall(DatabaseField field)

Implements org.eclipse.persistence.internal.databaseaccess.Platform.shouldUseCustomModifyForCall.

Used by SQLCall.appendModify(..) If the field should be passed to customModifyInDatabaseCall, retun true, otherwise false.
public boolean
supportsIdentity()

INTERNAL: Indicates whether the platform supports identity.

public boolean
public boolean
supportsReturnGeneratedKeys()

Indicates whether the platform supports the use of java.sql.Statement#RETURN_GENERATED_KEYS.

public boolean
supportsSequenceObjects()

INTERNAL: Indicates whether the platform supports sequence objects.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public boolean
usesPlatformDefaultSequence()

Implements org.eclipse.persistence.internal.databaseaccess.Platform.usesPlatformDefaultSequence.

INTERNAL: Indicates whether defaultSequence is the same as platform default sequence.
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait