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 ch.tocco.nice2.persist.core.api.entity.Entity
Entity.State
-
Field Summary
Fields inherited from class ch.tocco.nice2.persist.core.impl.hibernate.pojo.AbstractHibernateEntity
entityContext, entityInterceptor, logger, wasDeleted
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable Object
doGetOldValue
(String field) getTouchedProperties
(Function<String, Boolean> filter) boolean
isDirty()
protected abstract boolean
isUnsaved
(org.hibernate.engine.spi.EntityEntry entry) protected void
markAsDirtyIfNecessary
(String field, @Nullable Object newValue) void
void
setEntityContext
(EntityContext entityContext) Wraps the givenEntityContext
with a custom implementation that returns aAbstractDirtyCheckingEntity.DirtyCheckingPropertyAccessorService
.Methods inherited from class ch.tocco.nice2.persist.core.impl.hibernate.pojo.AbstractHibernateEntity
delete, getAutoFieldsDisabled, getChangedFields, getContext, getInnerInterceptor, getLogger, getManager, getModel, getRelatedEntity, getRelatedEntityOrNull, getTouchedFields, getTouchedRelations, getValue, getValue, getValue, getValue, getValue, getValue, getValueMap, internalGetValue, internalSetValue, isFieldChanged, isFieldTouched, isUpdatable, joinTx, markDeleted, resolveField, setAutoFieldsDisabled, setValue, syncInverseCollection, thisInstanceOrProxyIfAvailable, toString, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.persist.core.api.entity.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, 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:
getTouchedProperties
in classAbstractHibernateEntity
-
isDirty
public boolean isDirty() -
resetDirty
public void resetDirty() -
setEntityContext
Wraps the givenEntityContext
with a custom implementation that returns aAbstractDirtyCheckingEntity.DirtyCheckingPropertyAccessorService
.- Overrides:
setEntityContext
in classAbstractHibernateEntity
-