Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-524
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-524
Summary: iterate shows hasNext=true when nothing returned
Type: Bug
Status: Unassigned
Priority: Major
Project: Hibernate2
Components:
core
Versions:
2.1 rc1
Assignee:
Reporter: David R Robison
Created: Thu, 4 Dec 2003 4:47 PM
Updated: Thu, 4 Dec 2003 4:47 PM
Environment: postgresql on W2K
Description:
I use session.iterate() to retrieve a list of records. I know that the first time I issue the iterate, that it should return nothing. However, it still reports hasNext as true. Here is a code snipit:
public class SegmentTypeServices {
protected static Logger logger = Logger.getLogger(SegmentTypeServices.class.getName());
public static int nextSegmentTypeCode(ControlEventContext context) throws HibernateException, AppConfigError {
Session hbSession = HibernateSession.currentSession();
Iterator maxCodeList = hbSession.iterate("select max(sgType.comp_id.sgTypeCode) from com.orci.ITSAM.hibernate.SegmentType sgType " +
"where sgType.comp_id.siteDatabase.comp_id.site = ? " +
"and sgType.comp_id.siteDatabase.comp_id.dbId = ? ",
new Object[] {
SiteDatabaseServices.MyDbSiteCode(context),
SiteDatabaseServices.MyDbId(context) },
new Type[] {
Hibernate.INTEGER,
Hibernate.INTEGER });
if (!maxCodeList.hasNext()) return 1;
Object[] row = (Object[])maxCodeList.next();
return ((Integer)row[0]).intValue();
}
When I run it I get a java.util.NoSuchElementException: No more results exception.
Any ideas?
Thanks in advance,
David Robison
---------------------------------------------------------------------
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
|