org.hibernate.stat.Statistics.getEntityStatistics()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.hibernate.stat.Statistics.getEntityStatistics()方法的一些代码示例,展示了Statistics.getEntityStatistics()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Statistics.getEntityStatistics()方法的具体详情如下:
包路径:org.hibernate.stat.Statistics
类名称:Statistics
方法名:getEntityStatistics

Statistics.getEntityStatistics介绍

[英]find entity statistics per name
[中]查找每个名称的实体统计信息

代码示例

代码示例来源:origin: wildfly/wildfly

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, String entityName) {
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getEntityStatistics(entityName);
  }
  return null;
}

代码示例来源:origin: wildfly/wildfly

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, String entityName) {
  if (entityManagerFactory == null) {
    return null;
  }
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getEntityStatistics(entityName);
  }
  return null;
}

代码示例来源:origin: hibernate/hibernate-orm

private org.hibernate.stat.EntityStatistics getStatistics(
    EntityManagerFactory entityManagerFactory,
    String entityName) {
  if ( entityManagerFactory == null ) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap( SessionFactory.class );
  if ( sessionFactory != null ) {
    return sessionFactory.getStatistics().getEntityStatistics( entityName );
  }
  return null;
}

代码示例来源:origin: wildfly/wildfly

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, String entityName) {
  if (entityManagerFactory == null) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getEntityStatistics(entityName);
  }
  return null;
}

代码示例来源:origin: wildfly/wildfly

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, PathAddress pathAddress) {
  if (entityManagerFactory == null) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getEntityStatistics(pathAddress.getValue(HibernateStatistics.ENTITY));
  }
  return null;
}

代码示例来源:origin: gocd/gocd

entityStatistics.put(entityName, statistics.getEntityStatistics(entityName));

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 * 
 * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getEntityStats()
 */
public TabularData getEntityStats() {
  List<CompositeData> result = new ArrayList<CompositeData>();
  Statistics statistics = getStatistics();
  for (String entity : statistics.getEntityNames()) {
    EntityStats entityStats = new EntityStats(entity, statistics.getEntityStatistics(entity));
    result.add(entityStats.toCompositeData());
  }
  TabularData td = EntityStats.newTabularDataInstance();
  td.putAll(result.toArray(new CompositeData[result.size()]));
  return td;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

/**
 * @see StatisticsServiceMBean#getEntityStatistics(java.lang.String)
 */
public EntityStatistics getEntityStatistics(String entityName) {
  return stats.getEntityStatistics(entityName);
}
/**

代码示例来源:origin: hibernate/hibernate

/**
 * @see StatisticsServiceMBean#getEntityStatistics(java.lang.String)
 */
public EntityStatistics getEntityStatistics(String entityName) {
  return stats.getEntityStatistics(entityName);
}
/**

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

/**
 * @see StatisticsServiceMBean#getEntityStatistics(java.lang.String)
 */
public EntityStatistics getEntityStatistics(String entityName) {
  return stats.getEntityStatistics(entityName);
}
/**

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

/**
 * @see StatisticsServiceMBean#getEntityStatistics(java.lang.String)
 */
public EntityStatistics getEntityStatistics(String entityName) {
  return stats.getEntityStatistics(entityName);
}
/**

代码示例来源:origin: apache/tapestry-5

public EntityStatistics getEntityStatistics()
{
  return getStatistics().getEntityStatistics(currentEntityName);
}

代码示例来源:origin: org.jipijapa/jipijapa-hibernate4-1

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, String entityName) {
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getEntityStatistics(entityName);
  }
  return null;
}

代码示例来源:origin: org.jboss.eap/jipijapa-hibernate5

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, String entityName) {
  if (entityManagerFactory == null) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getEntityStatistics(entityName);
  }
  return null;
}

代码示例来源:origin: org.jboss.as/jboss-as-jpa-hibernate4

private boolean hasEntity(PathElement element) {
  boolean result = false;
  final Statistics stats = getStatistics();
  if (stats != null) {
    final String entityName = element.getValue();
    result = stats.getEntityStatistics(entityName) != null;
  }
  return result;
}

代码示例来源:origin: org.jboss.eap/jipijapa-hibernate4-3

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, String entityName) {
  if (entityManagerFactory == null) {
    return null;
  }
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getEntityStatistics(entityName);
  }
  return null;
}

代码示例来源:origin: org.terracotta.modules/tim-hibernate-cache-provider-3.2

public TabularData getEntityStats() {
 List<CompositeData> result = new ArrayList<CompositeData>();
 for (String entity : statistics.getEntityNames()) {
  EntityStats entityStats = new EntityStats(entity, statistics.getEntityStatistics(entity));
  result.add(entityStats.toCompositeData());
 }
 TabularData td = EntityStats.newTabularDataInstance();
 td.putAll(result.toArray(new CompositeData[result.size()]));
 return td;
}

代码示例来源:origin: at.chrl/chrl-orm

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(), "+", "+" };
}

代码示例来源:origin: org.jboss.eap/jipijapa-hibernate5-3

private org.hibernate.stat.EntityStatistics getStatistics(EntityManagerFactory entityManagerFactory, PathAddress pathAddress) {
  if (entityManagerFactory == null) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getEntityStatistics(pathAddress.getValue(HibernateStatistics.ENTITY));
  }
  return null;
}

代码示例来源:origin: org.jboss.as/jboss-as-jpa-hibernate4

private EntityStatistics entityStatistics(ModelNode operation) {
  final PathAddress address = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR));
  final String puResourceName = address.getElement(address.size() - 2).getValue();
  final String entityName = address.getLastElement().getValue();
  ManagementLookup stats = ManagementLookup.create(persistenceUnitRegistry, puResourceName);
  return stats == null ? null : stats.getStatistics().getEntityStatistics(entityName);
}

相关文章

Statistics类方法