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

public Class QuerySequence

extends StandardSequence
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.sequencing.TableSequence, org.eclipse.persistence.sequencing.UnaryTableSequence, org.eclipse.persistence.eis.EISSequence, org.eclipse.persistence.sequencing.NativeSequence
Imports
java.util.Vector, java.math.BigDecimal, org.eclipse.persistence.sessions.DataRecord, org.eclipse.persistence.queries.*, org.eclipse.persistence.internal.databaseaccess.Accessor, org.eclipse.persistence.internal.sessions.AbstractSession

Purpose: An generic query sequence mechanism.

Description This sequence allows the sequence operations to be customized through user defined queries. A select and update query can be set which can use custom SQL or stored procedures to define the sequencing mechanism. If a single stored procedure is used that does the update and select only the select query needs to be set.

Field Summary

Modifier and TypeField and Description
protected ValueReadQuery
protected boolean
protected boolean
protected boolean
protected boolean
protected DataModifyQuery
protected boolean
protected boolean

Constructor Summary

AccessConstructor and Description
public
public
QuerySequence(String name)

Create a new sequence with the name.

public
QuerySequence(String name, int size)

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

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

public
QuerySequence(boolean shouldAcquireValueAfterInsert, boolean shouldUseTransaction)

public
QuerySequence(String name, boolean shouldAcquireValueAfterInsert, boolean shouldUseTransaction)

public
QuerySequence(String name, int size, boolean shouldAcquireValueAfterInsert, boolean shouldUseTransaction)

public
QuerySequence(String name, int size, int initialValue, boolean shouldAcquireValueAfterInsert, boolean shouldUseTransaction)

Method Summary

Modifier and TypeMethod and Description
protected ValueReadQuery
buildSelectQuery()

INTERNAL:

protected ValueReadQuery
buildSelectQuery(String seqName, Integer size)

INTERNAL:

protected DataModifyQuery
buildUpdateQuery()

INTERNAL:

protected DataModifyQuery
buildUpdateQuery(String seqName, Number sizeOrNewValue)

INTERNAL:

protected Vector<Object>
createArguments(DatabaseQuery query, String seqName, Number sizeOrNewValue)

INTERNAL:

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 ValueReadQuery
getSelectQuery()

PUBLIC:

public DataModifyQuery
getUpdateQuery()

PUBLIC:

public int
hashCode()

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

Returns a hash code value for the object.
public void
public void
protected Object
select(Accessor accessor, AbstractSession writeSession, String seqName, Integer size)

INTERNAL:

public void
public void
setShouldAcquireValueAfterInsert(boolean shouldAcquireValueAfterInsert)

PUBLIC:

public void
setShouldSelectBeforeUpdate(boolean shouldSelectBeforeUpdate)

PUBLIC:

public void
setShouldSkipUpdate(boolean shouldSkipUpdate)

PUBLIC:

public void
setShouldUseTransaction(boolean shouldUseTransaction)

PUBLIC:

public void
public boolean
public boolean
public boolean
public boolean
protected void
update(Accessor accessor, AbstractSession writeSession, String seqName, Number sizeOrNewValue)

INTERNAL:

protected Number
Inherited from org.eclipse.persistence.sequencing.StandardSequence:
createVectorcreateVectorAtNextValgetGeneratedValuegetGeneratedVectorsetInitialValue

Field Detail

selectQueryback to summary
protected ValueReadQuery selectQuery
shouldAcquireValueAfterInsertback to summary
protected boolean shouldAcquireValueAfterInsert
shouldSelectBeforeUpdateback to summary
protected boolean shouldSelectBeforeUpdate
shouldSkipUpdateback to summary
protected boolean shouldSkipUpdate
shouldUseTransactionback to summary
protected boolean shouldUseTransaction
updateQueryback to summary
protected DataModifyQuery updateQuery
wasSelectQueryCreatedback to summary
protected boolean wasSelectQueryCreated
wasUpdateQueryCreatedback to summary
protected boolean wasUpdateQueryCreated

Constructor Detail

QuerySequenceback to summary
public QuerySequence()
QuerySequenceback to summary
public QuerySequence(String name)

Create a new sequence with the name.

QuerySequenceback to summary
public QuerySequence(String name, int size)

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

QuerySequenceback to summary
public QuerySequence(String name, int size, int initialValue)
QuerySequenceback to summary
public QuerySequence(boolean shouldAcquireValueAfterInsert, boolean shouldUseTransaction)
QuerySequenceback to summary
public QuerySequence(String name, boolean shouldAcquireValueAfterInsert, boolean shouldUseTransaction)
QuerySequenceback to summary
public QuerySequence(String name, int size, boolean shouldAcquireValueAfterInsert, boolean shouldUseTransaction)
QuerySequenceback to summary
public QuerySequence(String name, int size, int initialValue, boolean shouldAcquireValueAfterInsert, boolean shouldUseTransaction)

Method Detail

buildSelectQueryback to summary
protected ValueReadQuery buildSelectQuery()

INTERNAL:

buildSelectQueryback to summary
protected ValueReadQuery buildSelectQuery(String seqName, Integer size)

INTERNAL:

buildUpdateQueryback to summary
protected DataModifyQuery buildUpdateQuery()

INTERNAL:

buildUpdateQueryback to summary
protected DataModifyQuery buildUpdateQuery(String seqName, Number sizeOrNewValue)

INTERNAL:

createArgumentsback to summary
protected Vector<Object> createArguments(DatabaseQuery query, String seqName, Number sizeOrNewValue)

INTERNAL:

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
getSelectQueryback to summary
public ValueReadQuery getSelectQuery()

PUBLIC:

getUpdateQueryback to summary
public DataModifyQuery getUpdateQuery()

PUBLIC:

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
onConnectback to summary
public void onConnect()

Overrides org.eclipse.persistence.sequencing.StandardSequence.onConnect.

INTERNAL:

Annotations
@Override
onDisconnectback to summary
public void onDisconnect()

Overrides org.eclipse.persistence.sequencing.StandardSequence.onDisconnect.

INTERNAL:

Annotations
@Override
selectback to summary
protected Object select(Accessor accessor, AbstractSession writeSession, String seqName, Integer size)

INTERNAL:

setSelectQueryback to summary
public void setSelectQuery(ValueReadQuery query)

PUBLIC:

setShouldAcquireValueAfterInsertback to summary
public void setShouldAcquireValueAfterInsert(boolean shouldAcquireValueAfterInsert)

PUBLIC:

setShouldSelectBeforeUpdateback to summary
public void setShouldSelectBeforeUpdate(boolean shouldSelectBeforeUpdate)

PUBLIC:

setShouldSkipUpdateback to summary
public void setShouldSkipUpdate(boolean shouldSkipUpdate)

PUBLIC:

setShouldUseTransactionback to summary
public void setShouldUseTransaction(boolean shouldUseTransaction)

PUBLIC:

setUpdateQueryback to summary
public void setUpdateQuery(DataModifyQuery query)

PUBLIC:

shouldAcquireValueAfterInsertback to summary
public boolean shouldAcquireValueAfterInsert()

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

PUBLIC:

Annotations
@Override
shouldSelectBeforeUpdateback to summary
public boolean shouldSelectBeforeUpdate()

PUBLIC:

shouldSkipUpdateback to summary
public boolean shouldSkipUpdate()

PUBLIC:

shouldUseTransactionback to summary
public boolean shouldUseTransaction()

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

PUBLIC:

Annotations
@Override
updateback to summary
protected void update(Accessor accessor, AbstractSession writeSession, String seqName, Number sizeOrNewValue)

INTERNAL:

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

Implements abstract org.eclipse.persistence.sequencing.StandardSequence.updateAndSelectSequence.

INTERNAL:

Annotations
@Override