Class AbstractDirtyCheckingEntity
java.lang.Object
ch.tocco.nice2.persist.core.impl.hibernate.pojo.AbstractHibernateEntity
ch.tocco.nice2.persist.core.impl.hibernate.pojo.AbstractDirtyCheckingEntity
- All Implemented Interfaces:
EntityReference, Entity, EntityImplementor
- Direct Known Subclasses:
AbstractPojoEntity
Abstract base class for
AbstractHibernateEntity implementations which handles dirty
tracking.
When any setter of the entity is called, the field is marked as dirty (if the new value is different from
the persistent value).
This allows an efficient implementation of Entity.getState().
resetDirty() must be called by the framework after an entity
has been flushed.-
Nested Class Summary
Nested classes/interfaces inherited from interface Entity
Entity.State -
Field Summary
Fields inherited from class AbstractHibernateEntity
entityContext, entityInterceptor, logger, wasDeleted -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable ObjectdoGetOldValue(String field) getTouchedProperties(Function<String, Boolean> filter) booleanisDirty()protected abstract booleanisUnsaved(org.hibernate.engine.spi.EntityEntry entry) protected voidmarkAsDirtyIfNecessary(String field, @Nullable Object newValue) voidvoidsetEntityContext(EntityContext entityContext) Wraps the givenEntityContextwith a custom implementation that returns aAbstractDirtyCheckingEntity.DirtyCheckingPropertyAccessorService.Methods inherited from class AbstractHibernateEntity
delete, getAutoFieldsDisabled, getChangedFields, getContext, getInnerInterceptor, getLogger, getManager, getModel, getRelatedEntity, getRelatedEntityOrNull, getTouchedRelations, getValue, getValue, getValue, getValue, getValue, getValue, getValueMap, internalGetValue, internalSetValue, isFieldChanged, isUpdatable, joinTx, markDeleted, resolveField, setAutoFieldsDisabled, setValue, syncInverseCollection, thisInstanceOrProxyIfAvailable, toString, validateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Entity
getBool, getDate, getDateTime, getDecimal, getDouble, getFloat, getInt, getKey, getLong, getOldValue, getShort, getState, getString, getTime, hasKey, requireBool, requireDate, requireDateTime, requireDecimal, requireDouble, requireFloat, requireInt, requireKey, requireLong, requireOldValue, requireShort, requireString, requireTime, requireValue, requireValue, requireValue, requireValue, requireValue, requireValue, resolve, validate
-
Constructor Details
-
AbstractDirtyCheckingEntity
public AbstractDirtyCheckingEntity()
-
-
Method Details
-
markAsDirtyIfNecessary
-
doGetOldValue
-
isUnsaved
protected abstract boolean isUnsaved(org.hibernate.engine.spi.EntityEntry entry) -
getTouchedProperties
- Specified by:
getTouchedPropertiesin classAbstractHibernateEntity
-
isDirty
public boolean isDirty() -
resetDirty
public void resetDirty() -
setEntityContext
Wraps the givenEntityContextwith a custom implementation that returns aAbstractDirtyCheckingEntity.DirtyCheckingPropertyAccessorService.- Overrides:
setEntityContextin classAbstractHibernateEntity
-