内存不足异常,伴随着Apache ObJectRelationalBridge。

huangapple 未分类评论44阅读模式
英文:

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);

huangapple
  • 本文由 发表于 2020年7月23日 20:28:18
  • 转载请务必保留本文链接:https://java.coder-hub.com/63054277.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定