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

public abstract class AbstractDirtyCheckingEntity extends AbstractHibernateEntity
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.
  • Constructor Details

    • AbstractDirtyCheckingEntity

      public AbstractDirtyCheckingEntity()
  • Method Details

    • markAsDirtyIfNecessary

      protected void markAsDirtyIfNecessary(String field, @Nullable @Nullable Object newValue)
    • doGetOldValue

      @Nullable protected @Nullable Object doGetOldValue(String field)
    • isUnsaved

      protected abstract boolean isUnsaved(org.hibernate.engine.spi.EntityEntry entry)
    • getTouchedProperties

      protected Set<String> getTouchedProperties(Function<String,Boolean> filter)
      Specified by:
      getTouchedProperties in class AbstractHibernateEntity
    • isDirty

      public boolean isDirty()
    • resetDirty

      public void resetDirty()
    • setEntityContext

      public void setEntityContext(EntityContext entityContext)
      Wraps the given EntityContext with a custom implementation that returns a AbstractDirtyCheckingEntity.DirtyCheckingPropertyAccessorService.
      Overrides:
      setEntityContext in class AbstractHibernateEntity