Hi, i have to export a huge amount of datasets. My whole app works with hibernate and spring.
I have to export 300.000 to 3.000.000 Datasets...
At the Moment i do it that way
Code:
public List<ResellerArticle> getResellerArticlesForExport(final int resellerId,final boolean justUpdate) {
return (List<ResellerArticle>) getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Query query = session.createQuery("select a from ResellerArticle a left outer join fetch a.baseArticle where a.resellerId = ? "+(nurUpdate?"and justUpdate = 1)":""+ " " ));
query.setInteger(0, resellerId);
return query.list();
}
});
}
here i get some problems with the memory... i cant load all data and than write it...
should i work with an iterator or
query.setFirstResult(..);
query.setMaxResults(...);
or whats the best way in sucha case?
thanks for you help...