public interface PersistenceHandlerI
A `PersistenceHandlerI` acts as an intermediary between the application and the underlying persistence mechanism (e.g., a database). It provides methods to control transactions, create, retrieve, update, and delete objects, and manage the persistence context.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
$0 |
static int |
DB_LOCKED |
static int |
EXCLUSIVE |
static int |
READ_ONLY |
static int |
SHARED |
Modifier and Type | Method and Description |
---|---|
BO |
assureClassStability(BO bo,
int mode,
java.util.Set<java.lang.Long> keepLocked) |
void |
begin() |
void |
begin(int lockTimeout)
Initiates a new transaction within the persistence context.
|
void |
cancelCreate(BO bo) |
void |
cancelPurge(BO bo)
Cancels a previously scheduled purge operation for a BO.
|
void |
commit()
Actually creates new
BOs and persists changes to the database
storage; but is also called when data was just queried...? |
void |
create(BO bo) |
void |
dbLock(BO bo) |
boolean |
exists(java.lang.Class<? extends BOI> classtip,
java.lang.Long id) |
void |
finish() |
java.sql.Connection |
getJdbcConnection() |
SchemaI |
getSchema() |
boolean |
isActive()
Returns true if begin() was already called, false otherwise or if already finish()ed.
|
boolean |
isAutoFinish() |
boolean |
isFinished()
Returns true, if finish() was already called.
|
boolean |
isForSaving()
Returns true if the TransactionContext will remember all objects that were loaded with a readonly
lock.
|
boolean |
isLoadedReadOnly(java.lang.Long id)
Returns true if the BO with the passed id is currently loaded in read-only mode.
|
boolean |
isPersistent(BO bo) |
de.ipcon.db.core.QueryResultsI |
iterateNativeQuery(java.lang.String s) |
de.ipcon.db.core.QueryResultsI |
iterateNativeQuery(java.lang.String s,
java.lang.Object[] parms) |
de.ipcon.db.core.QueryResultsI |
iterateNativeQuery(java.lang.String s,
java.lang.Object[] parms,
short mode) |
de.ipcon.db.core.QueryResultsI |
iterateNativeQuery(java.lang.String s,
java.lang.Object[] parms,
short mode,
java.lang.String[] prefetchPaths) |
de.ipcon.db.core.QueryResultsI |
iterateQuery(java.lang.String s) |
de.ipcon.db.core.QueryResultsI |
iterateQuery(java.lang.String s,
java.lang.Object[] parms) |
de.ipcon.db.core.QueryResultsI |
iterateQuery(java.lang.String s,
java.lang.Object[] parms,
short mode) |
de.ipcon.db.core.QueryResultsI |
iterateRelationBOs(java.lang.Class<? extends BOI> classtip,
java.lang.Long id,
java.lang.String attName) |
de.ipcon.db.core.QueryResultsI |
iterateRelationBOs(java.lang.Class<? extends BOI> classtip,
java.lang.Long id,
java.lang.String attName,
short mode) |
java.util.List |
listQuery(java.lang.String s) |
java.util.List |
listQuery(java.lang.String s,
java.lang.Object[] parms) |
java.util.List |
listQuery(java.lang.String s,
java.lang.Object[] parms,
short mode) |
java.util.List |
listRelationBOs(java.lang.Class<? extends BOI> classtip,
java.lang.Long id,
java.lang.String attName) |
java.util.List |
listRelationBOs(java.lang.Class<? extends BOI> classtip,
java.lang.Long id,
java.lang.String attName,
short mode) |
BO |
load(java.lang.Class<? extends BOI> classtip,
java.lang.Long id,
int mode,
java.util.Set<java.lang.Long> keepLocked,
BO into,
boolean syncModeCheck) |
BO |
loadReadOnly(java.lang.Class<? extends BOI> classtip,
java.lang.Long id) |
void |
purge(BO bo)
Marks a BO for purging from persistent storage upon transaction commit.
|
void |
rollback() |
void |
setAutoFinish(boolean b) |
void |
setIgnoreMultipleBegin() |
void |
setInjectBOLoader(BOLoaderI bol) |
static final java.lang.String $0
static final int READ_ONLY
static final int SHARED
static final int EXCLUSIVE
static final int DB_LOCKED
void begin(int lockTimeout)
This method begins a new transaction for interacting with the underlying persistence mechanism (e.g., a database).
If a transaction is already active and #setIgnoreMultipleBegin(boolean) was called with true
,
the existing transaction is reused. Otherwise the concrete implementation may decide what to do in that case.
An `IllegalStateException` is thrown if the handler has already been finished.
The method also handles potential exceptions related to locking and general persistence errors.
lockTimeout
- time to wait in seconds until a locking error is reported in case some
object is already locked by another thread; defaults to -1.
Zero or less for no waiting, i.e. immediate timeout (or rather the defined lock-timeout
of JDO, which defaults to 30s), an infinite value for no timeout.java.lang.IllegalStateException
- If the handler has already been finished.LockNotGrantedException
- If a lock cannot be acquired on the database.PersistenceException
- If a general error occurs during the transaction initiation.void begin()
void dbLock(BO bo)
void create(BO bo)
void cancelCreate(BO bo)
void purge(BO bo)
This method schedules the specified BO for permanent deletion from the database.
bo
- The BO to be purged.java.lang.IllegalArgumentException
- if any of the following conditions occur:
void cancelPurge(BO bo)
This method removes the specified BO from the internal collection of objects marked for deletion upon transaction commit. It is essential to ensure that the provided BO was indeed scheduled for purging before calling this method.
bo
- The BO whose purge operation should be cancelled.java.lang.IllegalArgumentException
- if any of the following conditions occur:
boolean exists(java.lang.Class<? extends BOI> classtip, java.lang.Long id)
boolean isLoadedReadOnly(java.lang.Long id)
BO load(java.lang.Class<? extends BOI> classtip, java.lang.Long id, int mode, java.util.Set<java.lang.Long> keepLocked, BO into, boolean syncModeCheck)
boolean isPersistent(BO bo)
boolean isActive()
boolean isForSaving()
void rollback()
void commit()
BOs
and persists changes to the database
storage; but is also called when data was just queried...?void finish()
boolean isFinished()
void setAutoFinish(boolean b)
boolean isAutoFinish()
void setIgnoreMultipleBegin()
de.ipcon.db.core.QueryResultsI iterateQuery(java.lang.String s, java.lang.Object[] parms, short mode)
de.ipcon.db.core.QueryResultsI iterateQuery(java.lang.String s, java.lang.Object[] parms)
de.ipcon.db.core.QueryResultsI iterateQuery(java.lang.String s)
java.util.List listQuery(java.lang.String s, java.lang.Object[] parms, short mode)
java.util.List listQuery(java.lang.String s, java.lang.Object[] parms)
java.util.List listQuery(java.lang.String s)
de.ipcon.db.core.QueryResultsI iterateRelationBOs(java.lang.Class<? extends BOI> classtip, java.lang.Long id, java.lang.String attName, short mode)
de.ipcon.db.core.QueryResultsI iterateRelationBOs(java.lang.Class<? extends BOI> classtip, java.lang.Long id, java.lang.String attName)
java.util.List listRelationBOs(java.lang.Class<? extends BOI> classtip, java.lang.Long id, java.lang.String attName, short mode)
java.util.List listRelationBOs(java.lang.Class<? extends BOI> classtip, java.lang.Long id, java.lang.String attName)
java.sql.Connection getJdbcConnection()
BO assureClassStability(BO bo, int mode, java.util.Set<java.lang.Long> keepLocked)
SchemaI getSchema()
void setInjectBOLoader(BOLoaderI bol)
de.ipcon.db.core.QueryResultsI iterateNativeQuery(java.lang.String s, java.lang.Object[] parms, short mode, java.lang.String[] prefetchPaths)
de.ipcon.db.core.QueryResultsI iterateNativeQuery(java.lang.String s, java.lang.Object[] parms, short mode)
de.ipcon.db.core.QueryResultsI iterateNativeQuery(java.lang.String s, java.lang.Object[] parms)
de.ipcon.db.core.QueryResultsI iterateNativeQuery(java.lang.String s)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.