After needing and not finding the Criteria.count() method and then finding a request for it in JIRA, I went ahead and implemented it. Though there seems to
Chris, funny you should write this. This morning I was lamenting the fact that I my app, which mostly uses the Criteria API, is becoming sprinkled with HQL as well, because of the inability to do a few things via Criteria.
The two things I am missing in the criteria API are the count, as you mention, and a more generic order by mechanism. I'd like to be able using the Criteria api to do something like:
crit = session.createCriteria( clazz ); crit.add( Expression.eq( name, "foo" ) ); crit.addOrder( Order.orderBy( "rand()" ) ); <---- ???? crit.setMaxResults(1);
Perhaps this is already possible and I just haven't found how.
And the count functionality would be nice as:
crit = session.createCriteria( clazz ); crit.add( Expression.eq( name, "foo" ) ); int count = crit.count();
I understand the Criteria API is fairly new? I am wondering to what extent enhancements will be done in this area, and how far Gavin sees it going.
So, I guess I am just adding another voice of support for enhancements like this, and in fact was pretty close to tackling the count task myself. I am happy that you took it on.
Thanks, rjf&
------------------------------------------------------- This SF. Net email is sponsored by: GoToMyPC GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free! https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel