java.lang.Object
org.eclipse.persistence.sequencing.Sequence
org.eclipse.persistence.sequencing.StandardSequence
org.eclipse.persistence.sequencing.QuerySequence
org.eclipse.persistence.sequencing.NativeSequence
- All Implemented Interfaces:
Serializable
,Cloneable
Purpose: Define a database's native sequencing mechanism.
Description Many databases have built in support for sequencing. This can be a SEQUENCE object such as in Oracle, or a auto-incrementing column such as the IDENTITY field in Sybase. For an auto-incrementing column the preallocation size is always 1. For a SEQUENCE object the preallocation size must match the SEQUENCE objects "increment by".
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected QuerySequence
Allow sequencing to be delegated to another sequence if native sequencing is not supported.protected boolean
true indicates that identity is used and generatedKeys should be used - if the platform supports generatedKeys false indicates that identity is used and generatedKeys should not be used - if the platform does not support generatedKeysprotected boolean
true indicates that identity should be used - if the platform supports identity.Fields inherited from class org.eclipse.persistence.sequencing.QuerySequence
selectQuery, shouldAcquireValueAfterInsert, shouldSelectBeforeUpdate, shouldSkipUpdate, shouldUseTransaction, updateQuery, wasSelectQueryCreated, wasUpdateQueryCreated
Fields inherited from class org.eclipse.persistence.sequencing.Sequence
depth, initialValue, isCustomQualifier, name, platform, qualifier, shouldAlwaysOverrideExistingValue, size
-
Constructor Summary
ConstructorDescriptionNativeSequence
(boolean shouldUseIdentityIfPlatformSupports) NativeSequence
(String name) Create a new sequence with the name.NativeSequence
(String name, boolean shouldUseIdentityIfPlatformSupports) NativeSequence
(String name, int size) Create a new sequence with the name and sequence pre-allocation size.NativeSequence
(String name, int size, boolean shouldUseIdentityIfPlatformSupports) NativeSequence
(String name, int size, int initialValue) NativeSequence
(String name, int size, int initialValue, boolean shouldUseIdentityIfPlatformSupports) -
Method Summary
Modifier and TypeMethodDescriptionprotected ValueReadQuery
INTERNAL:protected ValueReadQuery
buildSelectQuery
(String seqName, Integer size) INTERNAL:boolean
Return the sequence delegate.boolean
Return if the sequence should be replaced by another sequence implementation.int
hashCode()
boolean
isNative()
void
INTERNAL:void
INTERNAL:void
setDelegateSequence
(QuerySequence delegateSequence) Set the sequence delegate.void
setShouldUseGeneratedKeysIfPlatformSupports
(boolean shouldUseGeneratedKeysIfPlatformSupports) void
setShouldUseIdentityIfPlatformSupports
(boolean shouldUseIdentityIfPlatformSupports) boolean
boolean
Methods inherited from class org.eclipse.persistence.sequencing.QuerySequence
buildUpdateQuery, buildUpdateQuery, createArguments, getSelectQuery, getUpdateQuery, select, setSelectQuery, setShouldAcquireValueAfterInsert, setShouldSelectBeforeUpdate, setShouldSkipUpdate, setShouldUseTransaction, setUpdateQuery, shouldAcquireValueAfterInsert, shouldSelectBeforeUpdate, shouldSkipUpdate, shouldUseTransaction, update, updateAndSelectSequence
Methods inherited from class org.eclipse.persistence.sequencing.StandardSequence
createVector, createVectorAtNextVal, getGeneratedValue, getGeneratedVector, setInitialValue
Methods inherited from class org.eclipse.persistence.sequencing.Sequence
clone, equalNameAndSize, getDatasourcePlatform, getGeneratedValue, getGeneratedVector, getInitialValue, getName, getPreallocationSize, getQualified, getQualifier, isConnected, isCustomQualifier, isTable, isUnaryTable, onConnect, onDisconnect, setDatasourcePlatform, setName, setPreallocationSize, setQualifier, setShouldAlwaysOverrideExistingValue, shouldAlwaysOverrideExistingValue, shouldAlwaysOverrideExistingValue, shouldUsePreallocation, toString, verifyPlatform
-
Field Details
-
shouldUseIdentityIfPlatformSupports
protected boolean shouldUseIdentityIfPlatformSupportstrue indicates that identity should be used - if the platform supports identity. false indicates that sequence objects should be used - if the platform supports sequence objects. -
shouldUseGeneratedKeysIfPlatformSupports
protected boolean shouldUseGeneratedKeysIfPlatformSupportstrue indicates that identity is used and generatedKeys should be used - if the platform supports generatedKeys false indicates that identity is used and generatedKeys should not be used - if the platform does not support generatedKeys -
delegateSequence
Allow sequencing to be delegated to another sequence if native sequencing is not supported.
-
-
Constructor Details
-
NativeSequence
public NativeSequence() -
NativeSequence
public NativeSequence(boolean shouldUseIdentityIfPlatformSupports) -
NativeSequence
Create a new sequence with the name. -
NativeSequence
-
NativeSequence
Create a new sequence with the name and sequence pre-allocation size. -
NativeSequence
-
NativeSequence
-
NativeSequence
public NativeSequence(String name, int size, int initialValue, boolean shouldUseIdentityIfPlatformSupports)
-
-
Method Details
-
isNative
public boolean isNative() -
setShouldUseIdentityIfPlatformSupports
public void setShouldUseIdentityIfPlatformSupports(boolean shouldUseIdentityIfPlatformSupports) -
shouldUseIdentityIfPlatformSupports
public boolean shouldUseIdentityIfPlatformSupports() -
setShouldUseGeneratedKeysIfPlatformSupports
public void setShouldUseGeneratedKeysIfPlatformSupports(boolean shouldUseGeneratedKeysIfPlatformSupports) -
shouldUseGeneratedKeysIfPlatformSupports
public boolean shouldUseGeneratedKeysIfPlatformSupports() -
equals
- Overrides:
equals
in classQuerySequence
-
hashCode
public int hashCode()- Overrides:
hashCode
in classQuerySequence
-
buildSelectQuery
INTERNAL:- Overrides:
buildSelectQuery
in classQuerySequence
-
buildSelectQuery
INTERNAL:- Overrides:
buildSelectQuery
in classQuerySequence
-
hasDelegateSequence
public boolean hasDelegateSequence()Return if the sequence should be replaced by another sequence implementation. This is used when the platform does not support the native sequence type. -
getDelegateSequence
Return the sequence delegate. This is used when the platform does not support the native sequence type. -
setDelegateSequence
Set the sequence delegate. This is used when the platform does not support the native sequence type. -
onConnect
public void onConnect()INTERNAL:- Overrides:
onConnect
in classQuerySequence
-
onDisconnect
public void onDisconnect()INTERNAL:- Overrides:
onDisconnect
in classQuerySequence
-