public final class TemporaryBuffer extends RecordBuffer
define(java.lang.Class<T>, java.lang.String, boolean)
method,
which, like the superclass' method of the same name, creates a proxy
object which client code uses to interact with the database.
Implementation Notes
Multiplexing. Because of limitations imposed by Hibernate's lack
of direct support for temp tables, a single temp table instance in the
backing database is multiplexed if multiple buffers of the same type of
DMO class are opened simultaneously in the same context. This can happen
either when calling code explicitly defines multiple temp table buffers
using the same DMO type, or when method calls pass a temp table DMO proxy
as a parameter. Multiplexing is used to enable Progress' semantic of
copying data between temp tables when they are passed as parameters to
nested procedure calls.
Multiplexing is achieved by adding a multiplex ID column to every temp table schema. Each buffer instance is assigned a unique multiplex ID the first time a scope is opened on it. Every access to the backing temp table (i.e., queries, updates, inserts, deletes) take the multiplex ID into account, such that the backing table is managed as multiple, virtual table instances, one per distinct multiplex ID.
A temp table is created (along with its indexes, if any) the first time a particular DMO type is accessed. It is only dropped when no buffers reference it. As buffers go in and out of scope, a context local "in-use" map is updated to reflect which buffers reference which physical temp tables. When a buffer goes out of scope, cleanup processing checks whether it is the last buffer to reference its backing table. If so, the table is dropped. If not, the table is not dropped, but all records with that buffer's multiplex ID are removed from the table.
Temporary buffers may be scoped globally, or to the top-level (i.e., method) scope. If global, cleanup is performed only when the context itself is about to go out of scope. If not global, cleanup is performed when the method scope is popped by the transaction manager. The latter coincides with the external procedure scope in Progress.
There is a notion of a master buffer and slave buffers. The former is created as the result of converting a DEFINE TEMP-TABLE Progress statement. The latter is created as the result of converting a DEFINE BUFFER FOR temp-table Progress statement. A master buffer and all of the associated slave buffers share the same multiplex ID, since these buffers must all point to the same backing, virtual temp table for their backing data. The first time any buffer in such a group has a multiplex ID assigned, all buffers in the group have their multiplex IDs assigned to the same value.
Modifier and Type | Class and Description |
---|---|
private static class |
TemporaryBuffer.Context
Helper which tracks the multiplex IDs currently in use by DMO interface
in the current client context, as well as the reference count of temp
tables created in the database using the context's current connection,
and domains of master/slave buffers.
|
static class |
TemporaryBuffer.CopyTableMode
Table copy mode.
|
private static class |
TemporaryBuffer.DefaultUndoState
A class that holds the default UNDO attibute for a TEMP-TABLE.
|
private class |
TemporaryBuffer.Multiplexer
An object registered with the
TransactionManager to be
notified when its enclosing buffer's scope is closing. |
private class |
TemporaryBuffer.NoUndoValidator
An object of this class is registered at all blocks within a no-undo buffer's scope, except
internal procedures (TODO: further testing is needed to verify that this is correct).
|
private class |
TemporaryBuffer.ReversibleBulkDelete
Concrete implementation of
Reversible which on rollback
reverses a bulk record delete action by setting the multiplex ID for
the targeted DMO's back to its original value. |
protected class |
TemporaryBuffer.TempValidationHelper
An extended
ValidationHelper which overrides methods which
must behave differently when validating temp tables. |
RecordBuffer.AbstractBulkReversible, RecordBuffer.DatumAccess, RecordBuffer.LightweightUndoable, RecordBuffer.MethodType, RecordBuffer.OperationType, RecordBuffer.ValidationHelper
Modifier and Type | Field and Description |
---|---|
private static org.hibernate.type.Type[] |
BULK_DELETE_CHECK_QUERY_PARM_TYPES
Hibernate parameter types passed to bulk delete check query
|
private static org.hibernate.type.Type[] |
BULK_DELETE_EVENT_QUERY_PARM_TYPES
Hibernate parameter types passed to bulk delete state change query
|
private java.lang.String |
bulkDeleteCheckSQL
SQL used to check whether a record was deleted from a virtual table
|
private java.lang.String |
bulkDeleteEventSQL
SQL used to check whether a record was deleted by a bulk delete
|
private static ContextLocal<TemporaryBuffer.Context> |
context
Multiplex ID sets currently in use for this context by DMO interface
|
private static org.hibernate.type.Type[] |
COPY_ALL_ROWS_QUERY_PARM_TYPES
Hibernate parameter types passed to copyAllRows() query
|
private java.lang.reflect.Constructor<?> |
dmoCtor
Constructor used to create new instances of the backing DMO
|
private TemporaryBuffer.Multiplexer |
dynamicMultiplexer
Globally-scoped multipler for dynamic temp-tables (
null for others) |
static java.lang.String |
ERROR_EXTENT_MISMATCH_TEMPLATE
Error text template for error 8029.
|
static java.lang.String |
ERROR_FIELD_TYPE_MISMATCH_TEMPLATE
Error text template for error 8028.
|
static java.lang.String |
ERROR_MISMATCHED_FIELDS
Error text for error 12324.
|
static java.lang.String |
ERROR_TABLE_MISMATCH_TEMPLATE
Error text template for error 8030.
|
private boolean |
global
Does this buffer represent a global temp table?
|
private TemporaryBuffer.Context |
local
Context associated with this buffer instance
|
private static java.util.logging.Logger |
LOG
Logger
|
private TemporaryBuffer |
master
Master buffer for this buffer; null indicates this is the master
|
(package private) static java.lang.String |
MULTIPLEX_FIELD_NAME
Name of the multiplex ID field in temp table DMO classes
|
private java.lang.Integer |
multiplexID
Multiplex ID assigned to this buffer instance
|
private TableParameter |
outputParameter
Destination table parameter for output copy if necessary before scope closes
|
private java.lang.String |
primaryOrderBy
Order by clause associated with primary index of backing temp-table, if any
|
private boolean |
referenceOnly
Flag indicating if REFERENCE-ONLY option was set for this TEMP-TABLE.
|
private TempTable |
tempTableRef
Reference to parent temp table; if master buffer exists this field is
null |
private UndoStateProvider |
undoStateProvider
Can property changes on this buffer be undone?
|
activeScopeDepth, blockDepth, bufferManager, changeBroker, delayed, openScopeCount, persistenceContext, registeredWithGlobalScope, relatedQueries
Modifier | Constructor and Description |
---|---|
private |
TemporaryBuffer(java.lang.Class<?> dmoBufIface,
java.lang.String variable,
boolean global,
UndoStateProvider undoable,
int blockDepth)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.util.Iterator<java.lang.String> |
activeTables()
Get an iterator on the names of all temp tables which currently exist
in the current context.
|
protected boolean |
allowsBulkActions()
Indicate whether this buffer implementation allows bulk actions.
|
static void |
associate(TableParameter src,
Temporary dstDMO,
boolean input,
boolean output)
Associate two temp tables with one another, such that all relevant
records can be copied between them at prescribed times.
|
static void |
associate(TableParameter src,
Temporary dstDMO,
boolean input,
boolean output,
boolean appendInput)
Associate two temp tables with one another, such that all relevant
records can be copied between them at prescribed times.
|
protected void |
closeConnectionManagerScope()
Deregister this buffer with the connection manager.
|
(package private) void |
closeMultiplexScope()
Close multiplex scope and mark the underlying table to be dropped when the session
closes.
|
void |
commit(boolean transaction)
Commit the changes made within a subtransaction.
|
(package private) static boolean |
copyAllRows(Temporary srcDMO,
Temporary dstDMO,
boolean append,
TemporaryBuffer.CopyTableMode errorMode)
Copy all records from one temp table to another, optionally appending
to records already present in the destination table.
|
(package private) static boolean |
copyAllRows(Temporary srcDMO,
Temporary dstDMO,
boolean append,
TemporaryBuffer.CopyTableMode errorMode,
boolean skipUniqueConflicts,
boolean replacePrimaryRecords,
boolean looseCopy)
Copy all records from one temp table to another, optionally appending to records already
present in the destination table.
|
(package private) static Temporary |
createDefaultDynamicBufferForTempTable(TempTableBuilder tempTable)
Create the default dynamic buffer for the dynamic temporary table.
|
(package private) static Temporary |
createDynamicBufferForTempTable(java.lang.Class<?> dmoIface,
java.lang.String bufferName,
RecordBuffer master,
int blockDepth)
Create a dynamic buffer for the temporary table.
|
private static Temporary |
createDynamicBufferForTempTable(java.lang.Class dmoIface,
java.lang.String bufferName,
RecordBuffer master,
TempTable tempTable,
int blockDepth)
Create a dynamic buffer for the temporary table.
|
static void |
createDynamicTable(TableParameter src,
handle target,
boolean input,
boolean output)
Creates a dynamic temporary table for the given temp table handle.
|
static void |
createDynamicTable(TableParameter src,
handle target,
boolean input,
boolean output,
boolean append)
Creates a dynamic temporary table for the given temp table handle.
|
static void |
deferCopyError()
Defer error that has occurred during
copyAllRows(com.goldencode.p2j.persist.Temporary, com.goldencode.p2j.persist.Temporary, boolean, com.goldencode.p2j.persist.TemporaryBuffer.CopyTableMode) processing. |
static <T extends Temporary> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global)
Define a new buffer which is based upon the specified interface.
|
static <T extends Temporary> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global,
boolean undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends Temporary> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global,
UndoStateProvider undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends Temporary> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global)
Define a new buffer which is based upon the specified interface.
|
static <T extends Temporary> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
boolean undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends Temporary> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
boolean undoable,
int blockDepth)
Define a new buffer which is based upon the specified interface.
|
static <T extends Temporary> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
UndoStateProvider undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends Temporary> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
UndoStateProvider undoable,
int blockDepth)
Define a new buffer which is based upon the specified interface.
|
static <T extends Temporary> |
define(Temporary template,
java.lang.String variable)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends Temporary> |
define(Temporary template,
java.lang.String variable,
int blockDepth)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends Temporary> |
define(Temporary template,
java.lang.String variable,
java.lang.String legacyName)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends Temporary> |
define(Temporary template,
java.lang.String variable,
java.lang.String legacyName,
boolean shared)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends Temporary> |
define(Temporary template,
java.lang.String variable,
java.lang.String legacyName,
int blockDepth)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends Temporary> |
define(Temporary template,
java.lang.String variable,
java.lang.String legacyName,
int blockDepth,
boolean shared)
Define a new buffer which is based upon a "master" buffer.
|
protected void |
delete()
Delete the current record from the database.
|
protected void |
delete(DataModelObject[] suppDMOs,
java.lang.String where,
java.lang.Object[] args)
Perform a bulk delete, restricted by the given where clause and query
substitution parameters.
|
protected void |
delete(java.lang.String where,
java.lang.Object[] args)
Perform a bulk delete, restricted by the given where clause and query
substitution parameters.
|
protected void |
deleteAll()
Perform a bulk delete of all records in the table associated with this buffer.
|
private void |
doCloseMultiplexScope()
Close the current multiplex scope for the underlying DMO type in the
current context.
|
protected java.util.Set<TemporaryBuffer> |
getAllSlaveBuffers()
Get all slave buffers associated with this buffer.
|
(package private) static Commitable |
getContextCommitable()
Get a context-local
Commitable which needs to have its
methods invoked on commit/rollback. |
static Temporary |
getDefaultBuffer(handle tempTableHandle)
Get default buffer for a temporary table.
|
protected java.lang.String |
getDynamicName()
Gets the legacy name assigned to a dynamically prepared temp-table.
|
protected java.lang.String |
getLDBName(java.lang.String ldbOrAlias)
Get the logical database name associated with this buffer.
|
protected RecordBuffer |
getMasterBuffer()
Retrieve the master record buffer for this buffer.
|
protected java.lang.Integer |
getMultiplexID()
Get the multiplex ID of this temporary buffer.
|
protected Database |
getPDB(java.lang.String ldbName)
Get the database information object associated with this buffer.
|
LockType |
getPinnedLockType(java.io.Serializable id)
Override the superclass method to always return LockType.NONE.
|
private java.lang.String |
getPrimaryOrderByClause()
Get the order by clause determined by this buffer's backing table's primary index, if any.
|
static int |
getTableCount()
Report the number of temp tables which currently exist in the current
context.
|
(package private) static void |
handleTablesDoNotMatch(TemporaryBuffer.CopyTableMode errorMode,
java.lang.String srcBufName,
java.lang.String dstBufName)
If
copyTempTableErrorMode is true then dispaly "The caller's
temp-table parameter {srcBufName} does not match to the target temp-table {dstBufName}"
error message and abend. |
boolean |
initialize()
Initialize the core data on which this buffer relies.
|
protected void |
initPinnedLockTypes()
Override the superclass method to do nothing.
|
protected RecordBuffer.ValidationHelper |
initValidationHelper()
Initialize the validation helper object.
|
static boolean |
insertAllRows(TableWrapper srcResultSet,
Temporary dstDMO,
boolean append,
TemporaryBuffer.CopyTableMode errorMode,
int tableParameterIndex)
Populate the temp table with records created using the specified result set.
|
protected Persistable |
instantiateDMO()
Create a new instance of the DMO implementation class associated with
this buffer, and assign this buffer's multiplex ID to it.
|
protected boolean |
isAutoCommit()
Indicate whether this is a temp-table buffer and we are not currently within an existing
database transaction.
|
boolean |
isGlobal()
Check if this buffer is associated with a global temp-table.
|
protected boolean |
isMultiplexed()
Indicate whether the backing table for this buffer is multiplexed; that
is, whether the backing table represents multiple, virtual tables by
using a multiplex ID to differentiate table segments.
|
private boolean |
isMultiplexScopeClosed()
Determine if the multiplex scope for the underlying DMO type in the current context is
closed.
|
protected boolean |
isTableDefinitelyEmpty()
Indicate whether the table backing this buffer is known to contain no rows.
|
protected boolean |
isTemporary()
Convenience method to indicate whether this buffer is backed by a
temporary table.
|
protected boolean |
isUndoable()
Indicate whether changes made to records managed by this buffer can be
undone during a rollback.
|
protected int |
lookupNumFields()
Look up the number of fields in the legacy table represented by this buffer.
|
private static TemporaryBuffer |
makeBuffer(java.lang.Class<?> dmoBufIface,
java.lang.String variable,
boolean global,
UndoStateProvider undoable)
Factory method to construct a new temporary buffer.
|
private static TemporaryBuffer |
makeBuffer(java.lang.Class<?> dmoBufIface,
java.lang.String variable,
boolean global,
UndoStateProvider undoable,
int blockDepth)
Factory method to construct a new temporary buffer.
|
protected java.io.Serializable |
nextPrimaryKey()
Returns the primary key for a new DMO associated with this buffer.
|
protected void |
openConnectionManagerScope()
Register this buffer with the connection manager.
|
private boolean |
openMultiplexScope()
Open a new multiplex scope for this buffer.
|
protected void |
openScope()
Open a new buffer scope for this record buffer.
|
protected void |
openScopeAt(int blockDepth)
Open a new buffer scope for this record buffer at the given block depth.
|
static void |
openScopeAt(int blockDepth,
DataModelObject... dmos)
Open scope for the dynamic buffers which back the specified DMO instances at the given block
depth.
|
(package private) void |
performOutputCopy()
Copy output data for the linked table parameter, if any.
|
protected void |
popPinnedLockScope(boolean transaction,
boolean undo)
Override the parent's implementation to do nothing.
|
protected void |
pushPinnedLockScope()
Override the parent's implementation to do nothing.
|
void |
readAllRows(java.util.function.Consumer<Persistable> rowHandler)
Read all rows from the virtual temp-table backing this buffer (i.e., only those rows with
this buffer's multiplex ID) and allow the given row handler to process each found row.
|
(package private) static java.util.List<java.lang.Object[]> |
readAllRows(Temporary srcDMO,
java.util.List<PropertyDefinition> props)
Read all rows from the table targeted by the specified buffer and return each row as an
array, each row's values in the ordered specified by the given property list.
|
protected void |
reclaimKeys(java.util.List<java.io.Serializable> keys)
Reclaim the given list of primary keys for re-use.
|
static void |
referenceOnly(Temporary... dmos)
Mark the specified temp-tables as having the REFERENCE-ONLY option.
|
private void |
removeRecords(DataModelObject[] extDMOs,
java.lang.String where,
java.lang.Object[] args,
boolean forceDelete)
Remove or change the multiplex ID for all record rows from the backing table which meet the
specified criteria.
|
protected void |
resourceDeleted()
Deregister a dynamic multiplexer object from the transaction manager's global finalizables
when this buffer goes out of scope and invoke the multiplexer's scope closure processing.
|
void |
rollback(boolean transaction)
Restores this buffer's state to that which it had at the beginning of
the current block.
|
void |
setPinnedLockType(java.io.Serializable id,
LockType pinnedLockType)
Override the superclass method to do nothing.
|
private void |
setReversibleBulkDelete(int mpid,
boolean hasWhere)
Create and set the current bulk delete reversible action.
|
(package private) void |
setTempTableRef(TempTable tempTableRef)
Set reference to the parent temp table.
|
void |
stateChanged(RecordChangeEvent event)
Respond to a record change event.
|
handle |
tableHandle()
Returns TABLE-HANDLE for the buffer.
|
private TempTable |
tempTableResource()
Get the
TempTable resource associated with this temporary buffer. |
protected void |
upgradeLock()
Override the superclass method to do nothing.
|
static Temporary |
useShared(java.lang.String variable,
java.lang.Class<? extends Temporary> expected)
Define a new buffer which is based upon a "master" buffer
stored in the
SharedVariableManager . |
addLegacyForeignKeys, areDMOsSame, armCurrentChanged, average, batch, buffer, cleanupBatchMode, closeRelatedQueries, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, copy, copy, copy, copy, count, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, createDynamicBufferForPermTable, createProxy, createSimplePropsMap, decrementDMOUseCount, define, define, define, defineAlias, defineReadOnly, deleted, describe, disableReleaseOnIterate, endBatch, enterBlock, equals, errorNotOnFile, evictDMOIfUnused, exitBlock, finished, flush, get, getBlockDepth, getBufferManager, getBufferType, getCommonProperties, getCurrentRecord, getDatabase, getDefaultBuffer, getDialect, getDirtyContext, getDirtyProperties, getDMOAlias, getDMOBufInterface, getDMOBufInterfaceForObject, getDMOImplementationClass, getDMOImplementationName, getDMOInterface, getDMOName, getDMOProxy, getEntityName, getExtentMap, getFieldColumnLabel, getFieldFormat, getFieldLabel, getFieldLiteralQuestion, getFieldValidateExpression, getFieldValidateMessage, getFieldValue, getIndexedProperties, getIndexHelper, getLegacyFieldNameMap, getLegacyGetterMap, getLegacyName, getLegacySetterMap, getLogicalDatabase, getNumFields, getOffEnd, getOpenScopeCount, getParentTable, getPDBName, getPersistence, getPersistenceContext, getPojoGetterMap, getPojoSetterMap, getQueryOffEndListener, getSchema, getScopeOpenDepth, getSnapshot, getTable, getUndoable, getValue, hashCode, incrementDMOUseCount, isActive, isAvailable, isDirtyCopy, isDynamic, isNewlyCreated, isPendingRollbackProcessed, isPropertyIndexed, isReadonly, isRecordChanged, isTransient, isUnknownMode, isWorldScope, iterate, loadTemplateRecord, markPersisted, maximum, maybeFireWriteTrigger, minimum, openScope, popTempContext, processMiddleBlocks, pushTempContext, recordBuffers, recordID, recordNotAvailableCharacter, recordNotAvailableComhandle, recordNotAvailableDate, recordNotAvailableDatetime, recordNotAvailableDatetimetz, recordNotAvailableDecimal, recordNotAvailableHandle, recordNotAvailableInt64, recordNotAvailableInteger, recordNotAvailableLogical, recordNotAvailableRaw, recordNotAvailableRecid, recordNotAvailableRowid, registerRelatedQuery, release, reload, reportChange, reportChange, reportValidationException, reset, resetPendingRollbackProcessed, retry, rollbackPending, rowID, setAmbiguous, setDynamic, setFieldColumnLabel, setFieldFormat, setFieldLabel, setFieldLiteralQuestion, setFieldValidateExpression, setFieldValidateMessage, setLocked, setOffEnd, setRecord, setTempRecord, setUnknownMode, silentBatch, startBatch, sum, throwOffEnd, toString, toString, unregisterRelatedQuery, updateCurrentChanged, validate, validate, validate, wasAmbiguous, wasLocked
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
initFailure
static final java.lang.String MULTIPLEX_FIELD_NAME
public static final java.lang.String ERROR_MISMATCHED_FIELDS
public static final java.lang.String ERROR_TABLE_MISMATCH_TEMPLATE
public static final java.lang.String ERROR_EXTENT_MISMATCH_TEMPLATE
public static final java.lang.String ERROR_FIELD_TYPE_MISMATCH_TEMPLATE
private static final java.util.logging.Logger LOG
private static final ContextLocal<TemporaryBuffer.Context> context
private static final org.hibernate.type.Type[] COPY_ALL_ROWS_QUERY_PARM_TYPES
private static final org.hibernate.type.Type[] BULK_DELETE_EVENT_QUERY_PARM_TYPES
private static final org.hibernate.type.Type[] BULK_DELETE_CHECK_QUERY_PARM_TYPES
private final boolean global
private UndoStateProvider undoStateProvider
private final TemporaryBuffer.Context local
private java.lang.reflect.Constructor<?> dmoCtor
private java.lang.String bulkDeleteEventSQL
private java.lang.String bulkDeleteCheckSQL
private TableParameter outputParameter
private java.lang.Integer multiplexID
private TemporaryBuffer.Multiplexer dynamicMultiplexer
null
for others)private TemporaryBuffer master
private TempTable tempTableRef
null
private java.lang.String primaryOrderBy
private boolean referenceOnly
private TemporaryBuffer(java.lang.Class<?> dmoBufIface, java.lang.String variable, boolean global, UndoStateProvider undoable, int blockDepth)
define(java.lang.Class<T>, java.lang.String, boolean)
factory method. The implementation class associated with the given
dmoIface
must have a constructor which accepts a multiplex
ID and must contain a _multiplex
instance variable of type
Integer
.dmoBufIface
- Interface which defines DMO's API. This interface MUST extend
Temporary
.variable
- Name of the variable with which the record buffer is associated
in the transaction manager whenever it is registered.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.public static void deferCopyError()
copyAllRows(com.goldencode.p2j.persist.Temporary, com.goldencode.p2j.persist.Temporary, boolean, com.goldencode.p2j.persist.TemporaryBuffer.CopyTableMode)
processing.public static <T extends Temporary> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends Temporary> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends Temporary> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global, UndoStateProvider undoable)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends Temporary> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global, boolean undoable)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- true
if changes made to records managed by this
buffer can be undone; false
if such changes are
committed immediately, such that they cannot be undone.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends Temporary> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, UndoStateProvider undoable)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends Temporary> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, boolean undoable)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- true
if changes made to records managed by this
buffer can be undone; false
if such changes are
committed immediately, such that they cannot be undone.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends Temporary> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, UndoStateProvider undoable, int blockDepth)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends Temporary> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, boolean undoable, int blockDepth)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends Temporary> T define(Temporary template, java.lang.String variable)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends Temporary> T define(Temporary template, java.lang.String variable, java.lang.String legacyName)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends Temporary> T define(Temporary template, java.lang.String variable, java.lang.String legacyName, boolean shared)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with a temporary buffer
that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be associated in the
transaction manager.legacyName
- Legacy name of the buffer.shared
- When true
, this flag indicates we are defining a new shared buffer.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends Temporary> T define(Temporary template, java.lang.String variable, int blockDepth)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends Temporary> T define(Temporary template, java.lang.String variable, java.lang.String legacyName, int blockDepth)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends Temporary> T define(Temporary template, java.lang.String variable, java.lang.String legacyName, int blockDepth, boolean shared)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.shared
- When true
, this flag indicates we are defining a new shared buffer.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static Temporary useShared(java.lang.String variable, java.lang.Class<? extends Temporary> expected)
SharedVariableManager
. This is used as an analog to the DEFINE SHARED
TEMP-TABLE statement when defining a buffer for a shared temp-table or
work-table which has been established elsewhere. The DMO interface,
global, and undoability settings of the master buffer are used for the
new buffer. This buffer will have the same multiplex ID as the master
buffer, which should have been assigned by an enclosing scope by the
time this method is invoked.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager and shared variable
manager.expected
- The expected DMO type of the existing master temp-table.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static void associate(TableParameter src, Temporary dstDMO, boolean input, boolean output)
src
- TableParameter
containing reference to the source
temporary buffer or result set.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the destination temporary buffer.input
- if true
, records are copied from source table to
destination table immediately upon invocation of this method,
otherwise they are not.output
- if true
, records are copied from destination
table back to source table when the current transaction or
subtransaction is committed; otherwise they are not.ErrorConditionException
- if a recoverable error occurs flushing the source buffer in
preparation for an input copy or while copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the
underlying DMOs to get or set data values.public static void associate(TableParameter src, Temporary dstDMO, boolean input, boolean output, boolean appendInput)
src
- TableParameter
containing reference to the source
temporary buffer or result set.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the destination temporary buffer.input
- if true
, records are copied from source table to
destination table immediately upon invocation of this method,
otherwise they are not.output
- if true
, records are copied from destination
table back to source table when the current transaction or
subtransaction is committed; otherwise they are not.appendInput
- true
to add new records without affecting
existing records; false
to remove all existing
records before the copy takes place. This option affects the
input
copy only, not the output
copy.ErrorConditionException
- if a recoverable error occurs flushing the source buffer in
preparation for an input copy or while copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the
underlying DMOs to get or set data values.public static void createDynamicTable(TableParameter src, handle target, boolean input, boolean output)
src
- TableParameter
containing reference to the source table.target
- Handle for storing the target table.input
- if true
, records are copied from source table to
destination table immediately upon invocation of this method,
otherwise they are not.output
- if true
, records are copied from destination
table back to source table when the current transaction or
subtransaction is committed; otherwise they are not.public static void createDynamicTable(TableParameter src, handle target, boolean input, boolean output, boolean append)
src
- TableParameter
containing reference to the source table.target
- Handle for storing the target table.input
- if true
, records are copied from source table to
destination table immediately upon invocation of this method,
otherwise they are not.output
- if true
, records are copied from destination
table back to source table when the current transaction or
subtransaction is committed; otherwise they are not.append
- true
to add new records without affecting
existing records; false
to remove all existing
records before the copy takes place. This option affects the
input
copy only, not the output
copy.public static Temporary getDefaultBuffer(handle tempTableHandle)
tempTableHandle
- Handle to a temporary table.public static java.util.Iterator<java.lang.String> activeTables()
public static int getTableCount()
public static boolean insertAllRows(TableWrapper srcResultSet, Temporary dstDMO, boolean append, TemporaryBuffer.CopyTableMode errorMode, int tableParameterIndex)
srcResultSet
- The source result set.dstDMO
- DMO instance refering the destination DMO buffer.append
- true
to append the data, false
to remove all records
first.errorMode
- Table copy mode, affects error handling.tableParameterIndex
- 1-based index of the corresponding table parameter (in declaration of the
function). Affects error handling.true
if copy was successful. false
if an error occurs
during copying records and error was recorder rather than thrown.ErrorConditionException
- if an error occurs during copying records.public static void referenceOnly(Temporary... dmos)
dmos
- Variable length list of DMO instances returned by previous calls to define(java.lang.Class<T>, java.lang.String, boolean)
.public static void openScopeAt(int blockDepth, DataModelObject... dmos)
blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer scopes are opened.dmos
- Variable length list of DMO instances returned by previous calls to define(java.lang.Class<T>, java.lang.String, boolean)
.static java.util.List<java.lang.Object[]> readAllRows(Temporary srcDMO, java.util.List<PropertyDefinition> props)
srcDMO
- The source DMO used to read the data.props
- The properties needed for this DMO.static Temporary createDynamicBufferForTempTable(java.lang.Class<?> dmoIface, java.lang.String bufferName, RecordBuffer master, int blockDepth)
createDefaultDynamicBufferForTempTable(TempTableBuilder)
.dmoIface
- DMO interface associated with the table.bufferName
- Target buffer name (4GL form).master
- Master buffer (default buffer of the target table).blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
scope of the create buffer is opened.static Temporary createDefaultDynamicBufferForTempTable(TempTableBuilder tempTable)
tempTable
- Temp-table object associated with the target table.private static Temporary createDynamicBufferForTempTable(java.lang.Class dmoIface, java.lang.String bufferName, RecordBuffer master, TempTable tempTable, int blockDepth)
dmoIface
- DMO interface associated with the table.bufferName
- Target buffer name (4GL form).master
- Master buffer (default buffer of the target table). Can be null
if the
default buffer for the table is created.tempTable
- Temp-table object associated with the target table.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
scope of the create buffer is opened.private static TemporaryBuffer makeBuffer(java.lang.Class<?> dmoBufIface, java.lang.String variable, boolean global, UndoStateProvider undoable)
dmoBufIface
- Interface which defines DMO's public API. This must be a
subinterface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.private static TemporaryBuffer makeBuffer(java.lang.Class<?> dmoBufIface, java.lang.String variable, boolean global, UndoStateProvider undoable, int blockDepth)
dmoBufIface
- Interface which defines DMO's public API. This must be a
subinterface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.static Commitable getContextCommitable()
Commitable
which needs to have its
methods invoked on commit/rollback.Commitable
object for the current context.static boolean copyAllRows(Temporary srcDMO, Temporary dstDMO, boolean append, TemporaryBuffer.CopyTableMode errorMode)
TODO: it seems this method can be optimized to use a DMO's deepCopy() method instead of reflection when the source and destination DMO types are the same.
srcDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the source temporary buffer.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the destination temporary buffer.append
- true
to add new records without affecting
existing records; false
to remove all existing
records before the copy takes place.errorMode
- Table copy mode, affects error handling.true
if copy was successful. false
if validation error
has occurred or the table is appended to itself.ErrorConditionException
- if a recoverable error occurs copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the
underlying DMOs to get or set data values.static boolean copyAllRows(Temporary srcDMO, Temporary dstDMO, boolean append, TemporaryBuffer.CopyTableMode errorMode, boolean skipUniqueConflicts, boolean replacePrimaryRecords, boolean looseCopy)
srcDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on the source
temporary buffer.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on the
destination temporary buffer.append
- true
to add new records without affecting existing records;
false
to remove all existing records before the copy takes place.errorMode
- Table copy mode, affects error handling.skipUniqueConflicts
- Corresponds append-mode in COPY-TEMP-TABLE. If there is a unique index on the
target temp-table and a row with a duplicate key is found, the row is not replaced.
This parameter is ignored if replacePrimaryRecords
is
true
.replacePrimaryRecords
- TODO implement support
Corresponds replace-mode in COPY-TEMP-TABLE. When true
records in the
target temp-table are replaced with corresponding records from the source
temp-table. The target temp-table must have a unique primary index that be can used
to find the corresponding record. When the corresponding record is found in the
target temp-table, the target record is replaced with the source record.looseCopy
- Corresponds loose-copy-mode in COPY-TEMP-TABLE. Only the fields with the same name
that appear in both the source and target temp-table are copied. Other fields are
ignored.true
if copy was successful. false
if validation error
has occurred or the table is appended to itself.ErrorConditionException
- if a recoverable error occurs copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the underlying DMOs to get or
set data values.static void handleTablesDoNotMatch(TemporaryBuffer.CopyTableMode errorMode, java.lang.String srcBufName, java.lang.String dstBufName)
copyTempTableErrorMode
is true
then dispaly "The caller's
temp-table parameter {srcBufName} does not match to the target temp-table {dstBufName}"
error message and abend. Else display "COPY-TEMP-TABLE requires {srcBufName} and
{dstBufName} columns to match exactly unless the fourth loose-mode parameter is passed as
TRUE" error message.errorMode
- Table copy mode, affects error handling.srcBufName
- Source buffer name.dstBufName
- Destination buffer name.public boolean isGlobal()
isGlobal
in class RecordBuffer
global
flag.public void rollback(boolean transaction)
BufferManager
.
Auto-commit buffers are never rolled back.
rollback
in interface Commitable
rollback
in class RecordBuffer
transaction
- true
if this commit represents the master
transaction rollback; false
if it represents a
sub-transaction rollback.public void commit(boolean transaction)
Nothing is done if this is a full transaction commit, because no rollback will be possible at the parent scope once the database-level transaction is committed.
If this is a full transaction and there are pending bulk actions, force those actions to be executed (i.e. force the delete).
commit
in interface Commitable
commit
in class RecordBuffer
transaction
- true
if this commit represents the master
transaction commit; false
if it represents a
sub-transaction commit.public void stateChanged(RecordChangeEvent event) throws PersistenceException
stateChanged
in interface RecordChangeListener
stateChanged
in class RecordBuffer
event
- Event which describes the DMO state change.PersistenceException
- if an error occurs executing a query to detect whether current
record still exists.public LockType getPinnedLockType(java.io.Serializable id)
getPinnedLockType
in class RecordBuffer
id
- Not used.RecordLockContext
public void setPinnedLockType(java.io.Serializable id, LockType pinnedLockType)
setPinnedLockType
in class RecordBuffer
id
- Not used.pinnedLockType
- Not used.RecordLockContext
public handle tableHandle()
tableHandle
in class RecordBuffer
public boolean initialize()
initialize
in class RecordBuffer
true
if the buffer was initialized with this call;
false
if the buffer had been initialized with a
previous call to this method.java.lang.IllegalArgumentException
- if no implementation class is found for the given database and
interface.java.lang.RuntimeException
- if the backing DMO implementation class does not implement a
constructor which accepts a multiplex ID.public void readAllRows(java.util.function.Consumer<Persistable> rowHandler)
rowHandler
- Consumer function which will handle each result row according to the needs of the
caller.ErrorConditionException
- if there is any error querying the rows in the table.protected java.lang.String getLDBName(java.lang.String ldbOrAlias)
DatabaseManager.TEMP_TABLE_DB
, regardless of the value of the
ldbOrAlias
parameter.getLDBName
in class RecordBuffer
ldbOrAlias
- A logical database name or database alias.protected Database getPDB(java.lang.String ldbName)
DatabaseManager.TEMP_TABLE_DB
, regardless of the value of the
ldbName
parameter.getPDB
in class RecordBuffer
ldbName
- A logical database name.protected void openConnectionManagerScope()
This implementation overrides the parent method to do nothing, since accesses to the temp table database are outside the scope of the connection manager's responsibilities.
openConnectionManagerScope
in class RecordBuffer
protected void closeConnectionManagerScope()
This implementation overrides the parent method to do nothing, since accesses to the temp table database are outside the scope of the connection manager's responsibilities.
closeConnectionManagerScope
in class RecordBuffer
protected Persistable instantiateDMO() throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
instantiateDMO
in class RecordBuffer
java.lang.InstantiationException
- if the class cannot be instantiated.java.lang.IllegalAccessException
- if the DMO class' target constructor cannot be accessed.java.lang.reflect.InvocationTargetException
- if the underlying constructor throws an exception.protected boolean isTemporary()
isTemporary
in class RecordBuffer
true
.protected int lookupNumFields()
lookupNumFields
in class RecordBuffer
protected boolean isTableDefinitelyEmpty()
This implementation involves only the virtual table backing the current buffer (i.e., whose multiplex ID matches that of this buffer), not the entire physical table.
isTableDefinitelyEmpty
in class RecordBuffer
true
if the table has no rows; false
if the table might have rows.protected boolean isAutoCommit()
isAutoCommit
in class RecordBuffer
true
if auto-commit, else false
.protected boolean isUndoable()
isUndoable
in class RecordBuffer
true
if record changes can be undone, else
false
.protected void upgradeLock() throws PersistenceException
upgradeLock
in class RecordBuffer
PersistenceException
- never.protected void pushPinnedLockScope()
pushPinnedLockScope
in class RecordBuffer
protected void popPinnedLockScope(boolean transaction, boolean undo)
popPinnedLockScope
in class RecordBuffer
transaction
- true
if we are at a full transaction boundary,
else false
.undo
- true
if we are processing an undo on the current
scope, else false
.protected java.lang.Integer getMultiplexID()
null
if this method is invoked before a buffer scope is
opened on this buffer for the first time. Otherwise, it will be a
unique identifier within the current context.getMultiplexID
in class RecordBuffer
protected boolean isMultiplexed()
Temp tables always are multiplexed.
isMultiplexed
in class RecordBuffer
true
.protected boolean allowsBulkActions()
allowsBulkActions
in class RecordBuffer
true
.protected RecordBuffer getMasterBuffer()
This only has meaning for shared temp tables. For a temp table defined as NEW SHARED, this buffer is returned. For a temp table defined as SHARED, the domain master buffer is returned.
getMasterBuffer
in class RecordBuffer
protected java.lang.String getDynamicName()
getDynamicName
in class RecordBuffer
null
if this buffer
represents a static temp-table.protected void openScope()
openScope
in class RecordBuffer
protected void openScopeAt(int blockDepth)
openScopeAt
in class RecordBuffer
blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer scope is opened.protected void resourceDeleted()
resourceDeleted
in class RecordBuffer
protected RecordBuffer.ValidationHelper initValidationHelper()
initValidationHelper
in class RecordBuffer
protected void initPinnedLockTypes()
initPinnedLockTypes
in class RecordBuffer
protected void deleteAll()
deleteAll
in class RecordBuffer
ErrorConditionException
- if an error occurs performing the bulk delete operation.protected java.util.Set<TemporaryBuffer> getAllSlaveBuffers()
void setTempTableRef(TempTable tempTableRef)
tempTableRef
- Parent temp table.void closeMultiplexScope()
void performOutputCopy()
private java.lang.String getPrimaryOrderByClause()
private void setReversibleBulkDelete(int mpid, boolean hasWhere)
ReversibleBulkDelete
instance.
If this block is not undoable, this method is a no-op.
mpid
- The multiplex ID used to mark those records as deleted.hasWhere
- Flag indicating if this bulk delete had a where clause or not.private boolean openMultiplexScope()
true
if this is the first multiplex scope opened
for the underlying DMO type; false
if multiplex
scopes are already open in this context for this DMO type.protected void delete(java.lang.String where, java.lang.Object[] args) throws PersistenceException
The targeted records are not actually removed from the buffer; instead, they are assigned another multiplex ID, which marks them as deleted.
Note: primary keys surrendered via bulk deletes are not currently recycled.
delete
in class RecordBuffer
where
- An HQL where clause snippet which defines the restriction
criteria to apply to the delete. All references to properties
in a DMO must be unqualified.args
- Query substitution parameters required by the where clause.PersistenceException
- if an error occurs performing the bulk delete operation.protected void delete(DataModelObject[] suppDMOs, java.lang.String where, java.lang.Object[] args) throws PersistenceException
The targeted records are not actually removed from the buffer; instead, they are assigned another multiplex ID, which marks them as deleted.
Note: primary keys surrendered via bulk deletes are not currently recycled.
delete
in class RecordBuffer
suppDMOs
- The DMOs for the external (additional) buffers that are accessed in inner
subselect, or null
in case of a simple where
predicate.where
- An HQL where clause snippet which defines the restriction
criteria to apply to the delete. All references to properties
in a DMO must be unqualified.args
- Query substitution parameters required by the where clause.PersistenceException
- if an error occurs performing the bulk delete operation.protected void delete() throws PersistenceException
delete
in class RecordBuffer
PersistenceException
- if no record currently is loaded in the buffer, or if there is
an error deleting the current record from the database.protected void reclaimKeys(java.util.List<java.io.Serializable> keys)
reclaimKeys
in class RecordBuffer
keys
- A list of primary keys which are available for re-use. Must
not be null
.protected java.io.Serializable nextPrimaryKey() throws PersistenceException
nextPrimaryKey
in class RecordBuffer
PersistenceException
- if there was an error while retrieving the next primary key.private void doCloseMultiplexScope() throws PersistenceException
PersistenceException
- if any error occurs within a listener while processing a
change event.private boolean isMultiplexScopeClosed()
closeMultiplexScope()
for more information.true
if multiplex scope is closed.private void removeRecords(DataModelObject[] extDMOs, java.lang.String where, java.lang.Object[] args, boolean forceDelete) throws PersistenceException
deleteAll()
and
RecordBuffer.delete(DataModelObject[], String, Object[])
methods.extDMOs
- The DMOs for the external (additional) buffers that are accessed in inner
subselect, or null
in case of a simple where
predicate.where
- An HQL where clause snippet which defines the restriction
criteria to apply to the delete. All references to properties
in a DMO must be unqualified. null
to delete all
records whose multiplex IDs match that of this buffer.args
- Query substitution parameters required by the where clause.
null
if there are no substitutions or no where clause.forceDelete
- Force the records to be deleted from the table, not just
marking them with a negative multiplex ID.PersistenceException
- if an error occurs performing the bulk delete operation.