Methods Summary |
---|
public java.lang.Object | clone()
try {
Sequence clone = (Sequence)super.clone();
if (isConnected()) {
clone.depth = 1;
clone.onDisconnect(getDatasourcePlatform());
}
return clone;
} catch (Exception exception) {
throw new InternalError("Clone failed");
}
|
public static boolean | equalNameAndSize(oracle.toplink.essentials.sequencing.Sequence seq1, oracle.toplink.essentials.sequencing.Sequence seq2)
if (seq1 == seq2) {
return true;
}
return seq1.getName().equals(seq2.getName()) && (seq1.getPreallocationSize() == seq2.getPreallocationSize());
|
public boolean | equals(java.lang.Object obj)
if (obj instanceof Sequence) {
return equalNameAndSize(this, (Sequence)obj);
} else {
return false;
}
|
public oracle.toplink.essentials.internal.databaseaccess.Platform | getDatasourcePlatform()
return platform;
|
public abstract java.lang.Object | getGeneratedValue(oracle.toplink.essentials.internal.databaseaccess.Accessor accessor, oracle.toplink.essentials.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).
|
public java.lang.Object | getGeneratedValue(oracle.toplink.essentials.internal.databaseaccess.Accessor accessor, oracle.toplink.essentials.internal.sessions.AbstractSession writeSession)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).
return getGeneratedValue(accessor, writeSession, getName());
|
public abstract java.util.Vector | getGeneratedVector(oracle.toplink.essentials.internal.databaseaccess.Accessor accessor, oracle.toplink.essentials.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).
|
public java.util.Vector | getGeneratedVector(oracle.toplink.essentials.internal.databaseaccess.Accessor accessor, oracle.toplink.essentials.internal.sessions.AbstractSession writeSession)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).
return getGeneratedVector(accessor, writeSession, getName(), getPreallocationSize());
|
public int | getInitialValue()
return initialValue;
|
public java.lang.String | getName()
return name;
|
public int | getPreallocationSize()
return size;
|
public boolean | isConnected()PUBLIC:
Indicates that Sequence is connected.
return platform != null;
|
public void | onConnect(oracle.toplink.essentials.internal.databaseaccess.Platform platform)INTERNAL:
This method is called when Sequencing object is created.
Don't override this method.
if (isConnected()) {
verifyPlatform(platform);
} else {
setDatasourcePlatform(platform);
onConnect();
}
depth++;
|
protected abstract void | onConnect()INTERNAL:
This method is called when Sequencing object is created.
If it requires initialization, subclass should override this method.
|
public void | onDisconnect(oracle.toplink.essentials.internal.databaseaccess.Platform platform)INTERNAL:
This method is called when Sequencing object is destroyed.
Don't overridethis method.
if (isConnected()) {
depth--;
if (depth == 0) {
onDisconnect();
setDatasourcePlatform(null);
}
}
|
protected abstract void | onDisconnect()INTERNAL:
This method is called when Sequencing object is destroyed.
If it requires deinitialization, subclass should override this method.
|
protected void | setDatasourcePlatform(oracle.toplink.essentials.internal.databaseaccess.Platform platform)
this.platform = platform;
|
public void | setInitialValue(int initialValue)
this.initialValue = initialValue;
|
public void | setName(java.lang.String name)
this.name = name;
|
public void | setPreallocationSize(int size)
this.size = size;
|
public abstract 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.
|
public abstract boolean | shouldOverrideExistingValue(java.lang.String seqName, java.lang.Object existingValue)INTERNAL:
Indicates whether existing attribute value should be overridden.
This method is called in case an attribute mapped to PK of sequencing-using
descriptor contains non-null value.
|
public boolean | shouldOverrideExistingValue(java.lang.Object existingValue)INTERNAL:
Indicates whether existing attribute value should be overridden.
This method is called in case an attribute mapped to PK of sequencing-using
descriptor contains non-null value.
return shouldOverrideExistingValue(getName(), existingValue);
|
public boolean | 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.
return !shouldAcquireValueAfterInsert();
|
public abstract boolean | 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.
|
protected void | verifyPlatform(oracle.toplink.essentials.internal.databaseaccess.Platform otherPlatform)INTERNAL:
Make sure that the sequence is not used by more than one platform.
if (getDatasourcePlatform() != otherPlatform) {
String hashCode1 = Integer.toString(System.identityHashCode(getDatasourcePlatform()));
String name1 = ((DatasourcePlatform)getDatasourcePlatform()).toString() + '(" + hashCode1 + ')";
String hashCode2 = Integer.toString(System.identityHashCode(otherPlatform));
String name2 = ((DatasourcePlatform)otherPlatform).toString() + '(" + hashCode2 + ')";
throw ValidationException.sequenceCannotBeConnectedToTwoPlatforms(getName(), name1, name2);
}
|