- All Implemented Interfaces:
Serializable,Comparable<DbModification>,ModificationLoggable,org.tentackle.misc.Identifiable,org.tentackle.misc.Immutable,org.tentackle.misc.SerialNumbered,SessionDependable,SessionProvider
@ClassId(1)
@TableName("modification")
public class DbModification
extends AbstractDbObject<DbModification>
Modification information per table.
- Author:
- harald
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DbObjectClassVariables<DbModification> Variables common to all instances ofDbModification.static final Stringdatabase column name for 'trackedName'.Fields inherited from class org.tentackle.dbms.AbstractDbObject
AN_CLASSID, AN_ID, AN_SERIAL, AN_TABLESERIAL, CN_CLASSID, CN_ID, CN_SERIAL, CN_TABLESERIAL, TX_DELETE_LIST, TX_DELETE_MISSING_IN_LIST, TX_DELETE_OBJECT, TX_DUMMY_UPDATE, TX_INSERT_OBJECT, TX_INSERT_PLAIN, TX_SAVE, TX_SAVE_LIST, TX_SYNC, TX_UPDATE_OBJECT, TX_UPDATE_PLAIN, TX_UPDATE_SERIAL, TX_UPDATE_SERIAL_AND_TABLESERIAL, TX_UPDATE_TABLESERIAL -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty modification object.DbModification(Db db) Creates an empty modification object.DbModification(Db db, String trackedName) Creates a modification object for a given tablename. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToModificationTable(boolean tableExists, String tableSerialTableName) Adds an entry for this counter (== database object class) to the modification table.intcountModification(long count) Counts modifications.
Adds the count to the table's entry and the master entry.createInsertSql(Backend backend) Creates the SQL code for the insert statement.createUpdateSql(Backend backend) Creates the SQL code for the update statement.Gets some attributes and variables common to all objects of the same class.voidRetrieves the values of all fields.Gets the attribute trackedName.static voidInitializes the modification table.longrefresh()Refreshes the contents of this modification entry by its name.org.tentackle.misc.IdSerialTupleselectIdSerial(String tableName) Selects the id and serial by tablename.longReads the master-serial.selectTableNameForId(long id) Selects the tablename for a given ID.intSets the values of all fields (all columns of the database table) in the givenPreparedStatementWrapperfrom the object's attributes.voidsetTrackedName(String trackedName) Sets the attribute trackedName.toString()Gets the default string value.
The default implementation invokesAbstractDbObject.toGenericString().Methods inherited from class org.tentackle.dbms.AbstractDbObject
acceptPersistenceVisitor, addPropertyListener, addPropertyListener, alignComponents, applyDbObjectResult, assertMutable, assertNew, assertNotNew, assertNotOverloaded, assertNotRemote, assertNumberOfRowsAffected, assertPersistable, assertRemote, assertThisRowAffected, attributesModified, clearOnRemoteSave, compareTo, countModification, createDeleteAllSql, createDeleteSql, createDummyUpdateSql, createPreparedStatement, createPreparedStatement, createPropertySupport, createSelectAllByIdInnerSql, createSelectAllIdSerialInnerSql, createSelectAllInnerSql, createSelectExpiredTableSerials1Sql, createSelectExpiredTableSerials2Sql, createSelectIdInnerSql, createSelectMaxIdSql, createSelectMaxTableSerialSql, createSelectObjectsWithExpiredTableSerialsSql, createSelectSerialSql, createSelectSql, createSqlUpdate, createStatementKey, createUpdateAndSetSerialSql, createUpdateSerialAndTableSerialSql, createUpdateSerialSql, deleteImpl, deleteObject, deletePlain, deleteReferencedRelations, deleteReferencingRelations, differsPersisted, dummyUpdate, equals, finishModification, finishNotUpdated, firePropertyChange, getBackend, getClassBaseName, getClassId, getColumnCount, getExpirationBacklog, getExpiredTableSerials, getId, getIdSource, getImmutableLoggingLevel, getModificationCount, getPreparedStatement, getPreparedStatement, getPropertySupport, getRemoteDelegate, getSerial, getSession, getSessionHolder, getTableName, getTableSerial, hashCode, initModification, insertImpl, insertObject, insertPlain, isCopy, isCountingModification, isDeleted, isEntity, isFinallyImmutable, isForcedModified, isFromThisJVM, isIdValid, isImmutable, isLoggingModification, isModified, isNew, isOverloadable, isPersistable, isReferenced, isRemovable, isReplayedLeniently, isSessionImmutable, isStatementAlwaysPrepared, isTableSerialProvided, isTracked, isUpdateNecessary, isUpdatingSerialEvenIfNotModified, isVirgin, loadLazyReferences, logModification, markDeleted, newId, newInstance, newInstance, newInstance, persistObject, prepareDelete, prepareSave, prepareSetFields, readFromResultSetWrapper, reloadObject, reloadObjectForUpdate, removeAllPropertyListeners, removePropertyListener, removePropertyListener, reserveId, reserveId, resultAllIdSerial, resultAllObjects, resultObjectsWithExpiredTableSerials, revertAttributesToSnapshot, saveObject, saveReferencedRelations, saveReferencingRelations, selectAllIdSerial, selectAllObjects, selectExpiredTableSerials, selectExpiredTableSerials, selectMaxId, selectMaxTableSerial, selectNextObject, selectObject, selectObjectForUpdate, selectObjectsWithExpiredTableSerials, selectSerial, setClassId, setFinallyImmutable, setId, setImmutable, setImmutableLoggingLevel, setModified, setOverloadable, setSerial, setSession, setSessionHolder, setSessionImmutable, setStatementAlwaysPrepared, setTableSerial, toGenericString, toIdString, unmarkDeleted, updateImpl, updateObject, updatePlain, updateSerial, updateSerial, updateSerialAndTableSerialMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.tentackle.dbms.ModificationLoggable
createModificationLog
-
Field Details
-
CLASSVARIABLES
Variables common to all instances ofDbModification. -
CN_TRACKEDNAME
database column name for 'trackedName'.- See Also:
-
-
Constructor Details
-
DbModification
Creates a modification object for a given tablename.- Parameters:
db- the session, null if thread-localtrackedName- the tracked name
-
DbModification
Creates an empty modification object.- Parameters:
db- the session
-
DbModification
public DbModification()Creates an empty modification object.
-
-
Method Details
-
initializeModificationTable
Initializes the modification table.- Parameters:
db- the session
-
getClassVariables
Description copied from class:AbstractDbObjectGets some attributes and variables common to all objects of the same class. Class variables for classes derived from AbstractDbObject are kept in an instance ofDbObjectClassVariables.- Overrides:
getClassVariablesin classAbstractDbObject<DbModification>- Returns:
- the class variables
-
toString
Description copied from class:AbstractDbObjectGets the default string value.
The default implementation invokesAbstractDbObject.toGenericString().- Overrides:
toStringin classAbstractDbObject<DbModification>- Returns:
- the string value of this AbstractDbObject
-
getFields
Description copied from class:AbstractDbObjectRetrieves the values of all fields.- Overrides:
getFieldsin classAbstractDbObject<DbModification>- Parameters:
rs- the result set
-
setFields
Description copied from class:AbstractDbObjectSets the values of all fields (all columns of the database table) in the givenPreparedStatementWrapperfrom the object's attributes.- Overrides:
setFieldsin classAbstractDbObject<DbModification>- Parameters:
st- the statement- Returns:
- the number of fields set
-
createInsertSql
Description copied from class:AbstractDbObjectCreates the SQL code for the insert statement.- Overrides:
createInsertSqlin classAbstractDbObject<DbModification>- Parameters:
backend- the backend- Returns:
- the SQL code
-
createUpdateSql
Description copied from class:AbstractDbObjectCreates the SQL code for the update statement.- Overrides:
createUpdateSqlin classAbstractDbObject<DbModification>- Parameters:
backend- the backend- Returns:
- the SQL code
-
getTrackedName
Gets the attribute trackedName.- Returns:
- the tablename
-
setTrackedName
Sets the attribute trackedName.- Parameters:
trackedName- the tablename
-
countModification
public int countModification(long count) Counts modifications.
Adds the count to the table's entry and the master entry.- Parameters:
count- the number of modifications to add- Returns:
- the number of modification rows updated (should be 2)
-
addToModificationTable
Adds an entry for this counter (== database object class) to the modification table. The tableserial is derived from the highest serial of all objects (i.e. class) this counter refers to.- Parameters:
tableExists- true if related to a PDO, false if just a nametableSerialTableName- the table to scan for max tableserial if PDO manages a tableserial
-
refresh
public long refresh()Refreshes the contents of this modification entry by its name.- Returns:
- the modification count
-
selectIdSerial
Selects the id and serial by tablename.- Parameters:
tableName- the database tablename- Returns:
- the id/serial tuple, null if no such table registered so far
-
selectTableNameForId
Selects the tablename for a given ID.- Parameters:
id- the table ID- Returns:
- the tablename, null if the such an ID does not exist
-
selectMasterSerial
public long selectMasterSerial()Reads the master-serial.- Returns:
- the master serial
-