Hibernate-criteria-statistics is a project mainly written in Java, based on the Security policy.
Sample projects on how to enable Criteria statistics in Hibernate with AspectJ until HHH-3452 gets fixed
Currently Hibernate statistics does not include information about criteria queries. According to this ticket [1] all it needs to make this work is add a method
protected String getQueryIdentifier() { return "[CRITERIA] " + getSQLString(); }
to CriteriaLoader class. As patching Hibernate itself would be rather tedious, this projects contains an AspectJ aspect to add the method via an inter-type declaration as well as a test to demonstrate it.
[1] - http://opensource.atlassian.com/projects/hibernate/browse/HHH-3452