count « Fetch « JPA Q&A





1. Fetch Tags and Tag count using HQL on SQL Server 2008    stackoverflow.com

I'm implementing tagging on a particular entity, using NHibernate on SQL Server 2008. The structure I have now is, simplifying, like this:

public class Entity {
    public Guid Id ...

2. fetch Sum , count and entity with HQL + ClassCastException    coderanch.com

18:39:06,136 INFO [STDOUT] Hibernate: select sum(transactio0_.amount) as col_0_0_, count(transactio0_.transaction_id) as col_1_0_, transactio0_.txn_datetime as col_2_0_, transactio0_.transaction_id as col_2_1_, transactio0_.merchantid as col_2_2_, transactio0_.txn_datetime as txn1_0_, transactio0_.transaction_id as transact2_0_, transactio0_.merchantid as merchantid0_, transactio0_.userid as userid0_, transactio0_.cardnumber as cardnumber0_, transactio0_.amount as amount0_, transactio0_.response_code as response7_0_, transactio0_.user_data as user8_0_, transactio0_.txn_status as txn9_0_, transactio0_.auth_code as auth10_0_, transactio0_.rrn as rrn0_, transactio0_.manual_txn_status as manual12_0_, transactio0_.booking_id as booking13_0_, transactio0_.notkt as ...

3. How to fetch total record count for any given criteria    forum.hibernate.org

well, it's not that simpile I mean with a GIVEN criteria here is my current code, i wonder if there would be a better solution. Code: private int getRecordCount(DetachedCriteria criteria) { Criteria c = criteria.getExecutableCriteria(getSession()); CriteriaImpl ci = (CriteriaImpl) c; ...