Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OQL syntax for counting objects matching criteria

how can I count objects in Eclipse MAT using OQL syntax? This doesn't work :

SELECT count(a) FROM org.hibernate.engine.EntityEntry a 
WHERE (toString(a.entityName)="my.pojo")

(I want to count the number of hibernate pojos loaded into memory)

There must be a very quick way to do so...Thanks for helping me out !

like image 842
chamaster Avatar asked May 12 '11 10:05

chamaster


1 Answers

SELECT toString(entry.entityName) FROM org.hibernate.engine.EntityEntry entry WHERE (toString(entry.entityName) = "My.Pojo")

In the result, count will show up as Total:X of Y entries. The value you are interested in is Y.

like image 156
Bhaskara Avatar answered Oct 14 '22 02:10

Bhaskara