From: <leg...@at...> - 2003-08-06 19:23:14
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-238 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-238 Summary: Documentation Bug - Retrieving the size of a collection Type: Improvement Status: Unassigned Priority: Trivial Project: Hibernate2 Components: core Versions: 2.0.2 Assignee: Reporter: Paul Rivers Created: Wed, 6 Aug 2003 2:23 PM Updated: Wed, 6 Aug 2003 2:23 PM Description: In the documentation in section 9.13, the is says: You can count the number of query results without actually returning them: Integer size = (Integer) s.filter( collection, "select count(*)" ).get(0); The query, session.filter() returns a collection, not a list! So the call to .get(0) results in a compile error. Instead, the correct way to do it is listed in the faq: ( (Integer) s.createFilter( collection, "select count(*)" ).iterate().next() ).intValue() --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |