package de.ivu.elect.business.system.entity;

import org.hibernate.stat.EntityStatistics;

public class ActivatedHibernateEntityStatistik extends HibernateEntityStatistik {
  private final EntityStatistics statistics;

  public ActivatedHibernateEntityStatistik(String name, EntityStatistics statistics) {
    super(name);
    this.statistics = statistics;
  }

  public long getInsertCount() {
    return statistics.getInsertCount();
  }

  public long getUpdateCount() {
    return statistics.getUpdateCount();
  }

  public long getDeleteCount() {
    return statistics.getDeleteCount();
  }

  /**
   * "the fetch counter only gets incremented when the entity is retrieved from the datasource (as opposed to any
   * caches)"
   * <p/>
   * http://stackoverflow.com/questions/609351/in-hibernate-statistics-whats-the-difference-between-load-and-fetch
   */
  public long getFetchCount() {
    return statistics.getFetchCount();
  }

  /**
   * "The load counter gets incremented any time the entity gets loaded, whether from the datasource or the caches."
   * <p/>
   * http://stackoverflow.com/questions/609351/in-hibernate-statistics-whats-the-difference-between-load-and-fetch
   */
  public long getLoadCount() {
    return statistics.getLoadCount();
  }

  public long getOptimisticFailureCount() {
    return statistics.getOptimisticFailureCount();
  }


}
