English 中文(简体)
自愿储存程序导致外包
原标题:Hibernate Stored Procedure invocation leads to OutOfMemory

我正在利用Hibernate spoint Query执行一个储存程序,归还一个庞大的数据集(200多万行)。 亚洲开发银行是Oracle 11g。

for instance: Query query = session.getNamedQuery(procName);

I know from the hibernate documentation, you cannot use setFirstResult/setMaxResult as stated on http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querysql.html.

整个数据集,如100 000字。 然而,一旦我用1 000 000 000 000美元进行测试,我就会发现外部错误。

从问答题看,我收到了一份名单。 我假定,数据仅一字不提,一字不提(<代码>query.list(>)。

I do not have a 2nd level cache configured. Will these settings help at all, when dealing with an Oracle Stored Procedure.

query.setCacheMode(org.hibernate.CacheMode.IGNORE); query.setFetchSize(1000);
query.scroll(org.hibernate.ScrollMode.FORWARD_ONLY);

基本上,我如何利用在Hibernate储存的代用品管理大型数据集检索。

百万美元

问题回答

这完全取决于你如何处理从询问中获得的数据。 如果你把它当作典型的问话题,即把它列入名单,并将结果储存起来,你会把你的记忆限制与这么多的几行相 bus。 关键是要把他们带入并处理。 http://docs.jboss.org/hibernate/core/3.5/javadocs/org/hibernate/ScrollableResults.html 届会自作为第一层切身起,将储存所有装载物体。 看一下Hibernate的批量处理情况,但需小心不要与Hibernate s batch fetching 和相关概念混淆。 这些动物有两种不同的动物。

Your issue is less one of Hibernate than one of memory usage. I had a similar situation where a JMS message worked fine with a small amount of data, then everything blew up with more. Since I doubt you need all 2mm records in memory at once, see if you can get the stored proc updated to take a limit and an offset so that it can return slices of data as opposed to only the whole dataset.





相关问题
Multiple Hibernate instances using C3P0

I am facing a weird problem and it seems to be c3p0 related. I am starting two instances of an app in the same java vm which interact with each other. After some operations "APPARENT DEADLOCK" ...

Hibernate vs Ibatis caching

We can speed up a hibernate app easyly with 2nd level cache using infinispan or ehcache/terracotta,... but ibatis only have a simple interface to implement for caching. And hibernate knows more ...

Using annotations to implement a static join in hibernate

I m relatively new to hibernate and was wondering if someone could help me out. While I have no issues implementing a normal join on multiple columns in hibernate using the @JoinColumns tag, I m ...

Hibernate query with fetch question

I have a 2 entities in a One-To-Many relationship: OfficeView.java: public class OfficeView implements java.io.Serializable { private Integer officeId; private String addr1; private ...

hibernate interceptors : afterTransactionCompletion

I wrote a Hibernate interceptor : public class MyInterceptor extends EmptyInterceptor { private boolean isCanal=false; public boolean onSave(Object entity, Serializable arg1, Object[] arg2, String[]...

How to prevent JPA from rolling back transaction?

Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...

Hibernate/GORM: collection was not processed by flush()

I have an integration test in my Grails application that fails when I try to save an entity of type Member invitingMember.save(flush: true) This raises the following exception org.hibernate....

Hibernate Criteria API equivalent for "elements()"

Is it possible to implement the following query using Criteria API? select order from ORDER as order,ITEM as item where item.itemID like ITM_01 and item in elements(order.items)

热门标签