[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2900) Autodiscovery results ignored by scroll()

Sergey Koshcheyev (JIRA) noreply at atlassian.com
Sat Oct 20 12:07:39 EDT 2007


Autodiscovery results ignored by scroll()
-----------------------------------------

                 Key: HHH-2900
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2900
             Project: Hibernate3
          Issue Type: Bug
          Components: query-hql, query-sql
    Affects Versions: 3.2.4.sp1
            Reporter: Sergey Koshcheyev
            Priority: Minor


Running this piece of code:

		session.createSQLQuery("create table tab(col integer)").executeUpdate();
		session.createSQLQuery("insert into tab values (1)").executeUpdate();
		ScrollableResults sr = session
			.createSQLQuery("select col from tab")
			.addScalar("col")
			.scroll(ScrollMode.FORWARD_ONLY);
		sr.next();
		sr.getInteger(0);

produces java.lang.NullPointerException
	at org.hibernate.impl.AbstractScrollableResults.getFinal(AbstractScrollableResults.java:126)
	at org.hibernate.impl.AbstractScrollableResults.getInteger(AbstractScrollableResults.java:208)

The problem seems to be Loader.scroll() is using its returnTypes parameter when instantiating ScrollableResultsImpl instead of letting CustomLoader use its autodiscovered resultTypes array.

A workaround seems to be to use ScrollableResults.get(int) since it doesn't rely on type 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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list