I've created a hibernate query that returns a List. I can see the returned size of this list to be 100 items. When I try to iterate over this, I get the following exception:
java.lang.ArrayIndexOutOfBoundsException: -1
Not sure what the issue is here. Below is the snippet of my code:
Code:
session = sessionFactory.getCurrentSession();
Query query = session.createQuery("from Book book where "
+ "book.createTimestamp < :orderDate");
query.setDate("orderDate", orderDate);
query.setCacheMode(CacheMode.IGNORE);
List<Book> books = query.list();
for(Book book : books) {
book......
}
I get the ArrayIndexOutOfBoundsException at the beginning of the for-loop. I checked that the returned List<Book> had the size of 100, so I know there are books in that List.
Any suggestions on how to troubleshoot and fix this? Thanks.
nefi