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 Link icon

    • AbstractDirtyCheckingEntity Link icon

      public AbstractDirtyCheckingEntity()
  • Method Details Link icon

    • markAsDirtyIfNecessary Link icon

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

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

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

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

      public boolean isDirty()
    • resetDirty Link icon

      public void resetDirty()
    • setEntityContext Link icon

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