0

I'm facing an OutOfMemoryException when trying to load a list of objects using OJB persistence broker. There are more than 20000 objects in the database (sybase). I have tried to limit the size of the returned list to 200. But the problem persists. Since OJB do not support paging, is there any solution to resolve this problem ?

PersistenceBroker broker= BrokerFactory.getBroker();
QueryByCriteria query =  new QueryByCriteria( Fo.class, criteria);
query.setEndAtIndex(200);
Collection listFo= broker.getCollectionByQuery(query);
GHASSEN
  • 51
  • 2
  • Does `Fo` have relationships with other classes? Could you possibly be pulling a large number of other objects into memory? – Willis Blackburn Jul 23 '20 at 19:08
  • Yes, Fo have many relationships with other classes. I can't change the current model architecture. So I'm wondering if I can do something like pagination or limiting the size of the returned list. – GHASSEN Jul 23 '20 at 20:28
  • There's usually some way with these frameworks to avoid pulling in relationships you don't need. Not familiar with this one in particular so can't tell you exactly how to do it. – Willis Blackburn Jul 23 '20 at 21:45

0 Answers0