I'm trying to return the top few items from my query, but I am still getting the whole list.
I'm trying to set the limit by using setMaxResults(max).
Can anyone point out what I am doing wrong in this query?
Thanks
Code:
org.hibernate.Transaction tx = session.beginTransaction();
Query q = session.createQuery( "from TbEventTrxn where biCustDeviceId="+custDeviceId+" and iEventTrxnTypeId="+txnTypeId+" and dtPostTime between :start and :end order by dtTranTime" );
q.setMaxResults(max);
q.setParameter( "start", startDate );
q.setParameter( "end", endDate );
list = (List<TbEventTrxn>)q.list();