public long count(final String qname,
final Map<String, Object> parameters) {
final Query query = this.createQuery(this.getFullQueryName(qname,
BaseEntityManager.COUNT_SUFFIX));
this.fittingQuery(query, parameters);
final Object result = query.uniqueResult();
if (result instanceof BigInteger) {
return ((BigInteger) result).longValue();
} else {
return ((Long) result).longValue();
}