[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2900?page=c...
]
Sergey Koshcheyev commented on HHH-2900:
----------------------------------------
Just paste the code I provided into any Hibernate test case class, you don't need any
mappings at all since it works on the native SQL level. The full stack trace is also in
the report - it's only the two lines.
Here's an improved version of the code doing clean up after the test:
Session session = openSession();
session.createSQLQuery("create table hhh2900(col integer)").executeUpdate();
session.beginTransaction();
try {
session.createSQLQuery("insert into hhh2900 values (1)").executeUpdate();
ScrollableResults sr = session
.createSQLQuery("select col from hhh2900")
.addScalar("col")
.scroll(ScrollMode.FORWARD_ONLY);
sr.next();
sr.getInteger(0);
session.getTransaction().commit();
} finally {
session.createSQLQuery("drop table hhh2900").executeUpdate();
session.close();
}
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira