[
https://issues.jboss.org/browse/ISPN-3953?page=com.atlassian.jira.plugin....
]
Radim Vansa commented on ISPN-3953:
-----------------------------------
I've noticed that when implementing the process operation. In my current
implementation (see
http://github.com/rvansa/infinispan-cachestore-jpa ) I load only all
keys and then load each entry in transaction. But this is far from optimal approach.
Shouldn't we rename the cachestore to infinispan-persistence-hibernate instead, then,
if we start using hibernate API? I have to write to infinispan-dev for the green.
JPACacheStore should not load all entities in memory
----------------------------------------------------
Key: ISPN-3953
URL:
https://issues.jboss.org/browse/ISPN-3953
Project: Infinispan
Issue Type: Enhancement
Components: Loaders and Stores
Reporter: Emmanuel Bernard
Assignee: Radim Vansa
Today several methods use getResultList() and load either all keys or all entities for a
given entity type in- memory at the same time.
This will likely blow up for big tables.
There are two solutions:
## Use Hibernate's specific features
Hibernate ORM has a session.scroll() method that offers a FORWARD_ONLY scrollable result
set. You can then load data and regularly (every 100?) clear the session before hitting
the next result. This will diminish greatly the memory pressure.
## Use a window model
get the number of entities in the table select count(*)
Then use setFirstResult / setMaxResults to navigate the data with a sliding window and
clear the session every time you move the window.
This won't be as efficient as Hibernate ORM's specific approach but will do the
work except on database that don't support the ability to start the results at the nth
element. Look up Hibernate dialects for more info.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira