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

public abstract Class StandardSequence

extends Sequence
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.sequencing.QuerySequence
Imports
java.util.Vector, org.eclipse.persistence.internal.databaseaccess.Accessor, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.exceptions.ValidationException, .DatabaseException

Purpose: An abstract class providing default sequence behavior.

Field Summary

Inherited from org.eclipse.persistence.sequencing.Sequence:
depthinitialValueisCustomQualifiernameplatformqualifiershouldAlwaysOverrideExistingValuesize

Constructor Summary

AccessConstructor and Description
protected
protected
protected
StandardSequence(String name, int size)

protected
StandardSequence(String name, int size, int initialValue)

Method Summary

Modifier and TypeMethod and Description
protected Vector<Number>
createVector(Number sequence, String
String is sequencing number field name
seqName
,
int
int size of Vector to create.
size
)

INTERNAL: given sequence = 10, size = 5 will create Vector (6,7,8,9,10)

protected Vector<Number>
createVectorAtNextVal(Number sequence, String
String is sequencing number field name
seqName
,
int
int size of Vector to create.
size
)

INTERNAL: given sequence = 10, size = 5 will create Vector (10,11,12,13,14)

public Object
getGeneratedValue(Accessor
Accessor is a separate sequencing accessor (may be null);
accessor
,
AbstractSession
Session is a Session used for writing (either ClientSession or DatabaseSession);
writeSession
,
String
String is sequencing number field name
seqName
)

Implements abstract org.eclipse.persistence.sequencing.Sequence.getGeneratedValue.

INTERNAL: Return the newly-generated sequencing value.
public Vector<?>
getGeneratedVector(Accessor
Accessor is a separate sequencing accessor (may be null);
accessor
,
AbstractSession
Session is a Session used for writing (either ClientSession or DatabaseSession);
writeSession
,
String
String is sequencing number field name
seqName
,
int
int number of values to preallocate (output Vector size).
size
)

Implements abstract org.eclipse.persistence.sequencing.Sequence.getGeneratedVector.

INTERNAL: Return a Vector of newly-generated sequencing values.
public void
onConnect()

Implements abstract org.eclipse.persistence.sequencing.Sequence.onConnect.

INTERNAL: This method is called when Sequencing object is created.
public void
onDisconnect()

Implements abstract org.eclipse.persistence.sequencing.Sequence.onDisconnect.

INTERNAL: This method is called when Sequencing object is destroyed.
public void
public abstract boolean
shouldAcquireValueAfterInsert()

Implements abstract org.eclipse.persistence.sequencing.Sequence.shouldAcquireValueAfterInsert.

INTERNAL: Indicates whether sequencing value should be acquired after INSERT.
public abstract boolean
shouldUseTransaction()

Implements abstract org.eclipse.persistence.sequencing.Sequence.shouldUseTransaction.

INTERNAL: Indicates whether TopLink should internally call beginTransaction() before getGeneratedValue/Vector, and commitTransaction after.
protected abstract Number
updateAndSelectSequence(Accessor accessor, AbstractSession writeSession, String seqName, int size)

Inherited from org.eclipse.persistence.sequencing.Sequence:
cloneequalNameAndSizeequalsgetDatasourcePlatformgetGeneratedValuegetGeneratedVectorgetInitialValuegetNamegetPreallocationSizegetQualifiedgetQualifierhashCodeisConnectedisCustomQualifierisNativeisTableisUnaryTableonConnectonDisconnectsetDatasourcePlatformsetNamesetPreallocationSizesetQualifiersetShouldAlwaysOverrideExistingValueshouldAlwaysOverrideExistingValueshouldAlwaysOverrideExistingValueshouldUsePreallocationtoStringverifyPlatform

Constructor Detail

StandardSequenceback to summary
protected StandardSequence()
StandardSequenceback to summary
protected StandardSequence(String name)
StandardSequenceback to summary
protected StandardSequence(String name, int size)
StandardSequenceback to summary
protected StandardSequence(String name, int size, int initialValue)

Method Detail

createVectorback to summary
protected Vector<Number> createVector(Number sequence, String seqName, int size)

INTERNAL: given sequence = 10, size = 5 will create Vector (6,7,8,9,10)

Parameters
seqName:String

String is sequencing number field name

size:int

int size of Vector to create.

createVectorAtNextValback to summary
protected Vector<Number> createVectorAtNextVal(Number sequence, String seqName, int size)

INTERNAL: given sequence = 10, size = 5 will create Vector (10,11,12,13,14)

Parameters
seqName:String

String is sequencing number field name

size:int

int size of Vector to create.

getGeneratedValueback to summary
public Object getGeneratedValue(Accessor accessor, AbstractSession writeSession, String seqName)

Implements abstract org.eclipse.persistence.sequencing.Sequence.getGeneratedValue.

Doc from org.eclipse.persistence.sequencing.Sequence.getGeneratedValue.

INTERNAL: Return the newly-generated sequencing value. Used only in case preallocation is not used (shouldUsePreallocation()==false). Accessor may be non-null only in case shouldUseSeparateConnection()==true. Even in this case accessor could be null - if SequencingControl().shouldUseSeparateConnection()==false; Therefore in case shouldUseSeparateConnection()==true, implementation should handle both cases: use a separate connection if provided (accessor != null), or get by without it (accessor == null).

Parameters
accessor:Accessor

Accessor is a separate sequencing accessor (may be null);

writeSession:AbstractSession

Session is a Session used for writing (either ClientSession or DatabaseSession);

seqName:String

String is sequencing number field name

Annotations
@Override
getGeneratedVectorback to summary
public Vector<?> getGeneratedVector(Accessor accessor, AbstractSession writeSession, String seqName, int size)

Implements abstract org.eclipse.persistence.sequencing.Sequence.getGeneratedVector.

Doc from org.eclipse.persistence.sequencing.Sequence.getGeneratedVector.

INTERNAL: Return a Vector of newly-generated sequencing values. Used only in case preallocation is used (shouldUsePreallocation()==true). Accessor may be non-null only in case shouldUseSeparateConnection()==true. Even in this case accessor could be null - if SequencingControl().shouldUseSeparateConnection()==false; Therefore in case shouldUseSeparateConnection()==true, implementation should handle both cases: use a separate connection if provided (accessor != null), or get by without it (accessor == null).

Parameters
accessor:Accessor

Accessor is a separate sequencing accessor (may be null);

writeSession:AbstractSession

Session is a Session used for writing (either ClientSession or DatabaseSession);

seqName:String

String is sequencing number field name

size:int

int number of values to preallocate (output Vector size).

Annotations
@Override
onConnectback to summary
public void onConnect()

Implements abstract org.eclipse.persistence.sequencing.Sequence.onConnect.

Doc from org.eclipse.persistence.sequencing.Sequence.onConnect.

INTERNAL: This method is called when Sequencing object is created. If it requires initialization, subclass should override this method.

Annotations
@Override
onDisconnectback to summary
public void onDisconnect()

Implements abstract org.eclipse.persistence.sequencing.Sequence.onDisconnect.

Doc from org.eclipse.persistence.sequencing.Sequence.onDisconnect.

INTERNAL: This method is called when Sequencing object is destroyed. If it requires deinitialization, subclass should override this method.

Annotations
@Override
setInitialValueback to summary
public void setInitialValue(int initialValue)

Overrides org.eclipse.persistence.sequencing.Sequence.setInitialValue.

Annotations
@Override
shouldAcquireValueAfterInsertback to summary
public abstract boolean shouldAcquireValueAfterInsert()

Implements abstract org.eclipse.persistence.sequencing.Sequence.shouldAcquireValueAfterInsert.

Doc from org.eclipse.persistence.sequencing.Sequence.shouldAcquireValueAfterInsert.

INTERNAL: Indicates whether sequencing value should be acquired after INSERT. Note that preallocation could be used only in case sequencing values should be acquired before insert (this method returns false). In default implementation, it is true for table sequencing and native sequencing on Oracle platform, false for native sequencing on other platforms.

Annotations
@Override
shouldUseTransactionback to summary
public abstract boolean shouldUseTransaction()

Implements abstract org.eclipse.persistence.sequencing.Sequence.shouldUseTransaction.

Doc from org.eclipse.persistence.sequencing.Sequence.shouldUseTransaction.

INTERNAL: Indicates whether TopLink should internally call beginTransaction() before getGeneratedValue/Vector, and commitTransaction after. In default implementation, it is true for table sequencing and false for native sequencing.

Annotations
@Override
updateAndSelectSequenceback to summary
protected abstract Number updateAndSelectSequence(Accessor accessor, AbstractSession writeSession, String seqName, int size)