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

public Class DefaultSequence

extends Sequence
Class Inheritance
Imports
java.util.Vector, org.eclipse.persistence.internal.databaseaccess.Accessor, org.eclipse.persistence.internal.sessions.AbstractSession

Purpose: Reference to the default sequence.

Description This sequence can be used to provide a sequence using the session's default sequencing mechanism but override the pre-allocation size.

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
public
DefaultSequence(String name)

Create a new sequence with the name.

public
DefaultSequence(String name, int size)

Create a new sequence with the name and sequence pre-allocation size.

public
DefaultSequence(String name, int size, int initialValue)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides org.eclipse.persistence.sequencing.Sequence.equals.

Indicates whether some other object is "equal to" this one.
public Sequence
getDefaultSequence()

INTERNAL: Return the platform's default sequence.

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 int
public int
public int
hashCode()

Overrides org.eclipse.persistence.sequencing.Sequence.hashCode.

Returns a hash code value for the object.
public boolean
public boolean
isConnected()

Overrides org.eclipse.persistence.sequencing.Sequence.isConnected.

PUBLIC: Indicates that Sequence is connected.
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
setQualifier(String qualifier)

Overrides org.eclipse.persistence.sequencing.Sequence.setQualifier.

INTERNAL: Ignored, getDefaultSequence().getQualifier() used instead.
public boolean
shouldAcquireValueAfterInsert()

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

INTERNAL: Indicates whether sequencing value should be acquired after INSERT.
public boolean
shouldAlwaysOverrideExistingValue(String seqName)

Overrides org.eclipse.persistence.sequencing.Sequence.shouldAlwaysOverrideExistingValue.

INTERNAL: Indicates whether the existing pk value should always be overridden by the sequence.
public boolean
shouldUsePreallocation()

Overrides org.eclipse.persistence.sequencing.Sequence.shouldUsePreallocation.

INTERNAL: Indicates whether several sequencing values should be acquired at a time and be kept by TopLink.
public boolean
shouldUseTransaction()

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

INTERNAL: Indicates whether EclipseLink should internally call beginTransaction() before getGeneratedValue/Vector, and commitTransaction after.
Inherited from org.eclipse.persistence.sequencing.Sequence:
cloneequalNameAndSizegetDatasourcePlatformgetGeneratedValuegetGeneratedVectorgetNamegetQualifiedgetQualifierisCustomQualifierisNativeisTableisUnaryTableonConnectonDisconnectsetDatasourcePlatformsetInitialValuesetNamesetPreallocationSizesetShouldAlwaysOverrideExistingValueshouldAlwaysOverrideExistingValuetoStringverifyPlatform

Constructor Detail

DefaultSequenceback to summary
public DefaultSequence()
DefaultSequenceback to summary
public DefaultSequence(String name)

Create a new sequence with the name.

DefaultSequenceback to summary
public DefaultSequence(String name, int size)

Create a new sequence with the name and sequence pre-allocation size.

DefaultSequenceback to summary
public DefaultSequence(String name, int size, int initialValue)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides org.eclipse.persistence.sequencing.Sequence.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getDefaultSequenceback to summary
public Sequence getDefaultSequence()

INTERNAL: Return the platform's default sequence.

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

Implements abstract 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.

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
getInitialValueback to summary
public int getInitialValue()

Overrides org.eclipse.persistence.sequencing.Sequence.getInitialValue.

Annotations
@Override
getPreallocationSizeback to summary
public int getPreallocationSize()

Overrides org.eclipse.persistence.sequencing.Sequence.getPreallocationSize.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides org.eclipse.persistence.sequencing.Sequence.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
hasPreallocationSizeback to summary
public boolean hasPreallocationSize()
isConnectedback to summary
public boolean isConnected()

Overrides org.eclipse.persistence.sequencing.Sequence.isConnected.

PUBLIC: Indicates that Sequence is connected.

Annotations
@Override
onConnectback to summary
public void onConnect()

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

INTERNAL: This method is called when Sequencing object is created. It's a chance to do initialization.

Annotations
@Override
onDisconnectback to summary
public void onDisconnect()

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

INTERNAL: This method is called when Sequencing object is destroyed.. It's a chance to do deinitialization.

Annotations
@Override
setQualifierback to summary
public void setQualifier(String qualifier)

Overrides org.eclipse.persistence.sequencing.Sequence.setQualifier.

INTERNAL: Ignored, getDefaultSequence().getQualifier() used instead.

Annotations
@Override
shouldAcquireValueAfterInsertback to summary
public boolean shouldAcquireValueAfterInsert()

Implements abstract 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
shouldAlwaysOverrideExistingValueback to summary
public boolean shouldAlwaysOverrideExistingValue(String seqName)

Overrides org.eclipse.persistence.sequencing.Sequence.shouldAlwaysOverrideExistingValue.

INTERNAL: Indicates whether the existing pk value should always be overridden by the sequence.

Annotations
@Override
shouldUsePreallocationback to summary
public boolean shouldUsePreallocation()

Overrides org.eclipse.persistence.sequencing.Sequence.shouldUsePreallocation.

INTERNAL: Indicates whether several sequencing values should be acquired at a time and be kept by TopLink. This in only possible in case sequencing numbers should be acquired before insert (shouldAcquireValueAfterInsert()==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 boolean shouldUseTransaction()

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

INTERNAL: Indicates whether EclipseLink 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