You can enable live statistics by setting the property hibernate.generate_statistics in theconfiguration file:


<property name="hibernate.generate_statistics">true</property>

It is also possible to enable live statistics programmatically using the Statistics Interface:


Statistics stats = sessionFactory.getStatistics();

stats.setStatisticsEnabled(true);

Transaction tx = session.beginTransaction();

List<Customer> c = session.createQuery("from Customer").list();

for(Customer c : customers){

System.out.println(c);

}

stats.getSessionOpenCount();

stats.logSummary();

session.close();

0
0
0
s2smodern