Class StandardSequence
- java.lang.Object
-
- org.eclipse.persistence.sequencing.Sequence
-
- org.eclipse.persistence.sequencing.StandardSequence
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
QuerySequence
public abstract class StandardSequence extends Sequence
Purpose: An abstract class providing default sequence behavior.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.sequencing.Sequence
depth, initialValue, isCustomQualifier, name, platform, qualifier, shouldAlwaysOverrideExistingValue, size
-
-
Constructor Summary
Constructors Constructor Description StandardSequence()StandardSequence(java.lang.String name)StandardSequence(java.lang.String name, int size)StandardSequence(java.lang.String name, int size, int initialValue)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.VectorcreateVector(java.lang.Number sequence, java.lang.String seqName, int size)INTERNAL: given sequence = 10, size = 5 will create Vector (6,7,8,9,10)protected java.util.VectorcreateVectorAtNextVal(java.lang.Number sequence, java.lang.String seqName, int size)INTERNAL: given sequence = 10, size = 5 will create Vector (10,11,12,13,14)java.lang.ObjectgetGeneratedValue(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, org.eclipse.persistence.internal.sessions.AbstractSession writeSession, java.lang.String seqName)INTERNAL: Return the newly-generated sequencing value.java.util.VectorgetGeneratedVector(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, org.eclipse.persistence.internal.sessions.AbstractSession writeSession, java.lang.String seqName, int size)INTERNAL: Return a Vector of newly-generated sequencing values.voidonConnect()INTERNAL: This method is called when Sequencing object is created.voidonDisconnect()INTERNAL: This method is called when Sequencing object is destroyed.voidsetInitialValue(int initialValue)abstract booleanshouldAcquireValueAfterInsert()INTERNAL: Indicates whether sequencing value should be acquired after INSERT.abstract booleanshouldUseTransaction()INTERNAL: Indicates whether TopLink should internally call beginTransaction() before getGeneratedValue/Vector, and commitTransaction after.protected abstract java.lang.NumberupdateAndSelectSequence(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, org.eclipse.persistence.internal.sessions.AbstractSession writeSession, java.lang.String seqName, int size)-
Methods inherited from class org.eclipse.persistence.sequencing.Sequence
clone, equalNameAndSize, equals, getDatasourcePlatform, getGeneratedValue, getGeneratedVector, getInitialValue, getName, getPreallocationSize, getQualified, getQualifier, hashCode, isConnected, isCustomQualifier, isNative, isTable, isUnaryTable, onConnect, onDisconnect, setDatasourcePlatform, setName, setPreallocationSize, setQualifier, setShouldAlwaysOverrideExistingValue, shouldAlwaysOverrideExistingValue, shouldAlwaysOverrideExistingValue, shouldUsePreallocation, toString, verifyPlatform
-
-
-
-
Method Detail
-
onConnect
public void onConnect()
Description copied from class:SequenceINTERNAL: This method is called when Sequencing object is created. If it requires initialization, subclass should override this method.
-
onDisconnect
public void onDisconnect()
Description copied from class:SequenceINTERNAL: This method is called when Sequencing object is destroyed. If it requires deinitialization, subclass should override this method.- Specified by:
onDisconnectin classSequence
-
updateAndSelectSequence
protected abstract java.lang.Number updateAndSelectSequence(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, org.eclipse.persistence.internal.sessions.AbstractSession writeSession, java.lang.String seqName, int size)
-
shouldAcquireValueAfterInsert
public abstract boolean shouldAcquireValueAfterInsert()
Description copied from class:SequenceINTERNAL: 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.- Specified by:
shouldAcquireValueAfterInsertin classSequence
-
shouldUseTransaction
public abstract boolean shouldUseTransaction()
Description copied from class:SequenceINTERNAL: 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.- Specified by:
shouldUseTransactionin classSequence
-
getGeneratedValue
public java.lang.Object getGeneratedValue(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, org.eclipse.persistence.internal.sessions.AbstractSession writeSession, java.lang.String seqName)Description copied from class:SequenceINTERNAL: 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).- Specified by:
getGeneratedValuein classSequence- Parameters:
accessor- Accessor is a separate sequencing accessor (may be null);writeSession- Session is a Session used for writing (either ClientSession or DatabaseSession);seqName- String is sequencing number field name
-
getGeneratedVector
public java.util.Vector getGeneratedVector(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, org.eclipse.persistence.internal.sessions.AbstractSession writeSession, java.lang.String seqName, int size)Description copied from class:SequenceINTERNAL: 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).- Specified by:
getGeneratedVectorin classSequence- Parameters:
accessor- Accessor is a separate sequencing accessor (may be null);writeSession- Session is a Session used for writing (either ClientSession or DatabaseSession);seqName- String is sequencing number field namesize- int number of values to preallocate (output Vector size).
-
createVector
protected java.util.Vector createVector(java.lang.Number sequence, java.lang.String seqName, int size)INTERNAL: given sequence = 10, size = 5 will create Vector (6,7,8,9,10)- Parameters:
seqName- String is sequencing number field namesize- int size of Vector to create.
-
createVectorAtNextVal
protected java.util.Vector createVectorAtNextVal(java.lang.Number sequence, java.lang.String seqName, int size)INTERNAL: given sequence = 10, size = 5 will create Vector (10,11,12,13,14)- Parameters:
seqName- String is sequencing number field namesize- int size of Vector to create.
-
setInitialValue
public void setInitialValue(int initialValue)
- Overrides:
setInitialValuein classSequence
-
-