英文:
OutOfMemoryException with Apache ObJectRelationalBridge
问题
我在尝试使用OJB持久化代理加载对象列表时遇到了OutOfMemoryException异常。数据库中有超过20000个对象(使用sybase)。我已经尝试将返回的列表大小限制为200。但问题仍然存在。由于OJB不支持分页,是否有解决此问题的方法?
PersistenceBroker broker = BrokerFactory.getBroker();
QueryByCriteria query = new QueryByCriteria(Fo.class, criteria);
query.setEndAtIndex(200);
Collection listFo = broker.getCollectionByQuery(query);
英文:
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);
专注分享java语言的经验与见解,让所有开发者获益!
评论