test case :
Code:
public void testScroll() {
Session session = openSession();
Transaction t = session.beginTransaction();
Course course = new Course();
course.setCourseCode("HIB");
course.setDescription("Hibernate Training");
session.persist(course);
Criteria c = session.createCriteria(Course.class);
ScrollableResults src = c.scroll();
session.delete(course);
t.commit();
session.close();
}
this method raise NPE :
Test fail with NPE
java.lang.NullPointerException
at org.hibernate.impl.ScrollableResultsImpl.<init>(ScrollableResultsImpl.java:202)
at org.hibernate.loader.Loader.scroll(Loader.java:1654)
at org.hibernate.loader.criteria.CriteriaLoader.scroll(CriteriaLoader.java:106)
at org.hibernate.impl.SessionImpl.scroll(SessionImpl.java:1288)
at org.hibernate.impl.CriteriaImpl.scroll(CriteriaImpl.java:310)
at org.hibernate.test.criteria.CriteriaQueryTest.testScroll(CriteriaQueryTest.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at org.hibernate.test.TestCase.runTest(TestCase.java:129)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
regards