EclipseLink 1.1.4, build 'v20100812-r7860' API Reference

org.eclipse.persistence.sequencing
Class DefaultSequence

java.lang.Object
  extended by org.eclipse.persistence.sequencing.Sequence
      extended by org.eclipse.persistence.sequencing.DefaultSequence
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class DefaultSequence
extends Sequence

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.

See Also:
Serialized Form

Field Summary
protected  Sequence defaultSequence
           
 
Fields inherited from class org.eclipse.persistence.sequencing.Sequence
depth, initialValue, name, platform, size
 
Constructor Summary
DefaultSequence()
           
DefaultSequence(java.lang.String name)
          Create a new sequence with the name.
DefaultSequence(java.lang.String name, int size)
          Create a new sequence with the name and sequence pre-allocation size.
DefaultSequence(java.lang.String name, int size, int initialValue)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 Sequence getDefaultSequence()
          INTERNAL: Return the platform's default sequence.
 java.lang.Object getGeneratedValue(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.Vector getGeneratedVector(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.
 int getInitialValue()
           
 int getPreallocationSize()
           
 boolean hasPreallocationSize()
           
protected  void onConnect()
          INTERNAL: This method is called when Sequencing object is created.
 void onDisconnect()
          INTERNAL: This method is called when Sequencing object is destroyed..
 boolean shouldAcquireValueAfterInsert()
          INTERNAL: Indicates whether sequencing value should be acquired after INSERT.
 boolean shouldUseTransaction()
          INTERNAL: Indicates whether EclipseLink should internally call beginTransaction() before getGeneratedValue/Vector, and commitTransaction after.
 
Methods inherited from class org.eclipse.persistence.sequencing.Sequence
clone, equalNameAndSize, getDatasourcePlatform, getGeneratedValue, getGeneratedVector, getName, isConnected, isNative, isTable, isUnaryTable, onConnect, onDisconnect, setDatasourcePlatform, setInitialValue, setName, setPreallocationSize, shouldUsePreallocation, verifyPlatform
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultSequence

protected Sequence defaultSequence
Constructor Detail

DefaultSequence

public DefaultSequence()

DefaultSequence

public DefaultSequence(java.lang.String name)
Create a new sequence with the name.


DefaultSequence

public DefaultSequence(java.lang.String name,
                       int size)
Create a new sequence with the name and sequence pre-allocation size.


DefaultSequence

public DefaultSequence(java.lang.String name,
                       int size,
                       int initialValue)
Method Detail

getDefaultSequence

public Sequence getDefaultSequence()
INTERNAL: Return the platform's default sequence.


hasPreallocationSize

public boolean hasPreallocationSize()

getPreallocationSize

public int getPreallocationSize()
Overrides:
getPreallocationSize in class Sequence

getInitialValue

public int getInitialValue()
Overrides:
getInitialValue in class Sequence

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Sequence

shouldAcquireValueAfterInsert

public boolean 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.

Specified by:
shouldAcquireValueAfterInsert in class Sequence

shouldUseTransaction

public boolean 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.

Specified by:
shouldUseTransaction in class Sequence

getGeneratedValue

public java.lang.Object getGeneratedValue(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. 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:
getGeneratedValue in class Sequence
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)
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).

Specified by:
getGeneratedVector in class Sequence
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
size - int number of values to preallocate (output Vector size).

onConnect

protected void onConnect()
INTERNAL: This method is called when Sequencing object is created. It's a chance to do initialization.

Specified by:
onConnect in class Sequence

onDisconnect

public void onDisconnect()
INTERNAL: This method is called when Sequencing object is destroyed.. It's a chance to do deinitialization.

Specified by:
onDisconnect in class Sequence

EclipseLink 1.1.4, build 'v20100812-r7860' API Reference