@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics( getEntityManagerFactory( args ), getStatisticName( args ) ); return Long.valueOf( statistics != null ? statistics.getUpdateCount() : 0 ); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getStatisticName(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getStatisticName(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getStatisticName(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
@Override protected void handle(EntityStatistics statistics, OperationContext context, String attributeName) { long count = statistics.getUpdateCount(); context.getResult().set(count); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getStatisticName(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getStatisticName(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getStatisticName(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getStatisticName(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
@Override public Object invoke(Object... args) { org.hibernate.stat.EntityStatistics statistics = getStatistics(getEntityManagerFactory(args), getPathAddress(args)); return Long.valueOf(statistics != null ? statistics.getUpdateCount() : 0); } };
protected void logEntities(StringBuilder builder, String lineSep, Statistics stats) { builder.append("Important entities statistics: ").append(lineSep); for (String entity : stats.getEntityNames()) { EntityStatistics entityStats = stats.getEntityStatistics(entity); if (entityStats.getInsertCount() > LIMIT || entityStats.getDeleteCount() > LIMIT || entityStats.getUpdateCount() > LIMIT || entityStats.getLoadCount() > LIMIT || entityStats.getFetchCount() > LIMIT) { builder.append(entity).append(" - ") .append("inserted: ").append(entityStats.getInsertCount()) .append(", updated: ").append(entityStats.getUpdateCount()) .append(", removed: ").append(entityStats.getDeleteCount()) .append(", loaded: ").append(entityStats.getLoadCount()) .append(", fetched: ").append(entityStats.getFetchCount()) .append(lineSep); } } builder.append(lineSep); }
public static String[] getEntityStatistics(final SessionFactory sessionFactory, final String entityName) { if (isNull(sessionFactory)) throw new NullPointerException("Parameter sessionFactory is null"); if (isNull(entityName)) throw new NullPointerException("Parameter entityName is null"); if (entityName.isEmpty()) throw new IllegalArgumentException("Parameter entityName is a empty String"); final Statistics sfstats = sessionFactory.getStatistics(); if (!ArrayUtils.contains(sfstats.getEntityNames(), entityName)) throw new IllegalArgumentException("Entity " + entityName + " is not managed by given SessionFactory"); final EntityStatistics stats = sfstats.getEntityStatistics(entityName); return new String[] { "+ Entity Statistics: " + entityName, "+", "+ Fetched: " + stats.getFetchCount(), "+ Inserted: " + stats.getInsertCount(), "+ Loaded: " + stats.getLoadCount(), "+ Updated: " + stats.getUpdateCount(), "+ Deleted: " + stats.getDeleteCount(), "+ Optimistic Lock Failures: " + stats.getOptimisticFailureCount(), "+", "+" }; }
public EntityStats(String name, EntityStatistics src) { this(name); this.loadCount = src.getLoadCount(); this.updateCount = src.getUpdateCount(); this.insertCount = src.getInsertCount(); this.deleteCount = src.getDeleteCount(); this.fetchCount = src.getFetchCount(); this.optimisticFailureCount = src.getOptimisticFailureCount(); }
public EntityStats(String name, EntityStatistics src) { this(name); this.loadCount = src.getLoadCount(); this.updateCount = src.getUpdateCount(); this.insertCount = src.getInsertCount(); this.deleteCount = src.getDeleteCount(); this.fetchCount = src.getFetchCount(); this.optimisticFailureCount = src.getOptimisticFailureCount(); }
public EntityStats(String name, EntityStatistics src) { this(name); this.loadCount = src.getLoadCount(); this.updateCount = src.getUpdateCount(); this.insertCount = src.getInsertCount(); this.deleteCount = src.getDeleteCount(); this.fetchCount = src.getFetchCount(); this.optimisticFailureCount = src.getOptimisticFailureCount(); }
private void addEntityStats(List<ApplicationStat> res, Statistics stats) { addStat(res, "entity/total/deletes", stats.getEntityDeleteCount()); addStat(res, "entity/total/fetches", stats.getEntityFetchCount()); addStat(res, "entity/total/inserts", stats.getEntityInsertCount()); addStat(res, "entity/total/loads", stats.getEntityLoadCount()); addStat(res, "entity/total/updates", stats.getEntityUpdateCount()); for (String entityName : stats.getEntityNames()) { EntityStatistics entStats = stats.getEntityStatistics(entityName); addStat(res, "entity/" + entityName + "/deletes", entStats.getDeleteCount()); addStat(res, "entity/" + entityName + "/fetches", entStats.getFetchCount()); addStat(res, "entity/" + entityName + "/inserts", entStats.getInsertCount()); addStat(res, "entity/" + entityName + "/loads", entStats.getLoadCount()); addStat(res, "entity/" + entityName + "/updates", entStats.getUpdateCount()); } }