I'm trying to analyze a heap dump to determine if my hibernate cache settings are the cause.

Many instances of the object in question are referred to by "org.hibernate.internal.util.collections.IdentityMap". How can I construct an OQL query to return me the exact number of instances of my object that are referred to by hibernate?

But this will make MAT go through every object in the heap, so it will take a long time to return results (assuming you have a reasonably large heap). However the real problem is that I find the dominatorof() function to be inconsistent, so you may not find every object. If you have a list of classes, then you may be able to speed up the query and also confirm that you are getting the right dominators. E.g., if X and Y are the class names, you can use "X|Y" as the regex instead of ".*" and also run this query to see what you get: