BZ1032192 - AlertCondition composite queries, query each column

Hibernate would return an empty entity and consequently lead to N+1 selects.

The code is ugly, unfortunately.

Adding tests for these queries