@Override public long count(Query query, HibernateParameter... parameters) { return (Long) HibernateTool.setParameters(query, parameters) .setResultTransformer(CriteriaSpecification.PROJECTION) .setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY) .uniqueResult(); }
@Override public <T> List<T> find( Class<T> clazz, Query query, int firstResult, int maxResults, HibernateParameter... parameters) { Query q = HibernateTool.setParameters(query, parameters); return (List<T>) HibernateTool.setPaging(q, firstResult, maxResults).list(); }
@Override public int executeUpdate(Query query, HibernateParameter... parameters) { return HibernateTool.setParameters(query, parameters).executeUpdate(); }
@Override public <T> T findUnique(Class<T> clazz, Query query, HibernateParameter... parameters) { return (T) HibernateTool.setParameters(query, parameters).uniqueResult(); }
@Override public <T> List<T> find(Class<T> clazz, Query query, HibernateParameter... parameters) { return (List<T>) HibernateTool.setParameters(query, parameters).list(); }
@Override public ScrollableResults scroll( Query query, ScrollMode scrollMode, HibernateParameter... parameters) { return HibernateTool.setParameters(query, parameters).scroll(scrollMode); }