1

First, I'm using Java and Hibernate (with setFech() method and ScrollableResults class).

Second, I'm working with a table that has dozen of millions of rows and more than one hundred of columns. And this table joins with other two. So a simple "select count(*)" takes 1 minute.

I'm using the code below to bring me the result of a select, that will return some millions of rows and all the columns. So it's mandatory that I use fetch.

session = ((Session) manager.getDelegate()).getSessionFactory().openStatelessSession();
Query q = session.createSQLQuery(query).addEntity(MyEntity.class).setFetchSize(1000);

After this first select, I need to know the total of lines of the search but I wouldn't want to do another select (it takes 1 minute) and I can't to call all scroll.next(). Is it possible to do that?

Marcel
  • 2,810
  • 2
  • 26
  • 46

0 Answers0