As it turns out, the queries used by the alert manager do not return
the AlertCondition object, so for large caches, there are N+1 queries
to the databases. This is not a problem in small cases, but in some
there's 1000+ queries made. This is especially slow with a remote
database.
Which led me to post this question:
http://stackoverflow.com/questions/23506988/jpql-constructor-expressions-...
The obvious solution is to select every column individually, then
create an AlertCondition by hand. The problem with this is it means
changing lots of queries, class constructors and the like.
Is this something worth undertaking? If somebody can think of a better
way, let me know.