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

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

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

Statistics.getCollectionStatistics介绍

[英]Get collection statistics per role
[中]获取每个角色的集合统计信息

代码示例

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
  if ( entityManagerFactory == null ) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap( SessionFactory.class );
  if ( sessionFactory != null ) {
    return sessionFactory.getStatistics().getCollectionStatistics( collectionName );
  }
  return null;
}

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
  if (entityManagerFactory == null) {
    return null;
  }
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
  }
  return null;
}

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
  if (entityManagerFactory == null) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
  }
  return null;
}

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
  if (entityManagerFactory == null) {
    return null;
  }
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
  }
  return null;
}

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, PathAddress pathAddress) {
  if (entityManagerFactory == null) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(pathAddress.getValue(HibernateStatistics.COLLECTION));
  }
  return null;
}

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

roleStatistics.put(roleName, statistics.getCollectionStatistics(roleName));

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

/**
 * {@inheritDoc}
 * 
 * @see net.sf.ehcache.hibernate.management.api.HibernateStats#getCollectionStats()
 */
public TabularData getCollectionStats() {
  List<CompositeData> result = new ArrayList<CompositeData>();
  Statistics statistics = getStatistics();
  for (String roleName : statistics.getCollectionRoleNames()) {
    CollectionStats collectionStats = new CollectionStats(roleName, statistics.getCollectionStatistics(roleName));
    result.add(collectionStats.toCompositeData());
  }
  TabularData td = CollectionStats.newTabularDataInstance();
  td.putAll(result.toArray(new CompositeData[result.size()]));
  return td;
}

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

/**
 * @see StatisticsServiceMBean#getCollectionStatistics(java.lang.String)
 */
public CollectionStatistics getCollectionStatistics(String role) {
  return stats.getCollectionStatistics(role);
}
/**

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

/**
 * @see StatisticsServiceMBean#getCollectionStatistics(java.lang.String)
 */
public CollectionStatistics getCollectionStatistics(String role) {
  return stats.getCollectionStatistics(role);
}
/**

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

/**
 * @see StatisticsServiceMBean#getCollectionStatistics(java.lang.String)
 */
public CollectionStatistics getCollectionStatistics(String role) {
  return stats.getCollectionStatistics(role);
}
/**

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

/**
 * @see StatisticsServiceMBean#getCollectionStatistics(java.lang.String)
 */
public CollectionStatistics getCollectionStatistics(String role) {
  return stats.getCollectionStatistics(role);
}
/**

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
  }
  return null;
}

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
  if (entityManagerFactory == null) {
    return null;
  }
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
  }
  return null;
}

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
  if (entityManagerFactory == null) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
  }
  return null;
}

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

private boolean hasCollection(PathElement element) {
  boolean result = false;
  final Statistics stats = getStatistics();
  if (stats != null) {
    final String collectionName = element.getValue();
    result = stats.getCollectionStatistics(collectionName) != null;
  }
  return result;
}

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, String collectionName) {
  HibernateEntityManagerFactory entityManagerFactoryImpl = (HibernateEntityManagerFactory) entityManagerFactory;
  SessionFactory sessionFactory = entityManagerFactoryImpl.getSessionFactory();
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(collectionName);
  }
  return null;
}

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

public TabularData getCollectionStats() {
 List<CompositeData> result = new ArrayList<CompositeData>();
 for (String roleName : statistics.getCollectionRoleNames()) {
  CollectionStats collectionStats = new CollectionStats(roleName, statistics.getCollectionStatistics(roleName));
  result.add(collectionStats.toCompositeData());
 }
 TabularData td = CollectionStats.newTabularDataInstance();
 td.putAll(result.toArray(new CompositeData[result.size()]));
 return td;
}

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

public static String[] getCollectionStatistics(final SessionFactory sessionFactory, final String collectionRoleName) {
  if (isNull(sessionFactory))
    throw new NullPointerException("Parameter sessionFactory is null");
  if (isNull(collectionRoleName))
    throw new NullPointerException("Parameter collectionRoleName is null");
  if (collectionRoleName.isEmpty())
    throw new IllegalArgumentException("Parameter collectionRoleName is a empty String");
  final Statistics sfstats = sessionFactory.getStatistics();
  if (!ArrayUtils.contains(sfstats.getCollectionRoleNames(), collectionRoleName))
    throw new IllegalArgumentException("Collection Role " + collectionRoleName + " is not managed by given SessionFactory");
  final CollectionStatistics stats = sfstats.getCollectionStatistics(collectionRoleName);
  return new String[] { "+ Collection Statistics: " + collectionRoleName, "+", "+ Fetched: " + stats.getFetchCount(), "+ Recreated: " + stats.getRecreateCount(), "+ Loaded: " + stats.getLoadCount(), "+ Updated: " + stats.getUpdateCount(), "+ Removed: " + stats.getRemoveCount(), "+", "+" };
}

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

private CollectionStatistics getStatistics(final EntityManagerFactory entityManagerFactory, PathAddress pathAddress) {
  if (entityManagerFactory == null) {
    return null;
  }
  SessionFactory sessionFactory = entityManagerFactory.unwrap(SessionFactory.class);
  if (sessionFactory != null) {
    return sessionFactory.getStatistics().getCollectionStatistics(pathAddress.getValue(HibernateStatistics.COLLECTION));
  }
  return null;
}

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

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

相关文章

Statistics类方法