| Author |
Heap exception while loading complete table data from database
|
Matt Josh
Greenhorn
Joined: Mar 16, 2011
Posts: 3
|
|
Hi
In my project I am using JPA.
Recently we have created JPA pojo from existing Tables in schema using JPA Entities from Table tool.
Now I am using Spring JpaDaoSupport at DAO layer.
I started with simple query to fetch POJO based on primary key that works fine.
when I try to fetch all data for given entity it throws heap error.
My entity as strucuture something like this.
Please suggest if I can implemenet some kind of lazy initialization to avoid heap issue
I am very new to JPA based implementation request you to please give suggestion on initialization and load strategy.
Matt
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
You are already using lazy initialization. Could it be that you just don;t have enough heap space to load all Entity records?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Matt Josh
Greenhorn
Joined: Mar 16, 2011
Posts: 3
|
|
|
Is it possible to set Lazy loading for OneToOne mapping ojects?
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Yes, but you are not using OneToOne mappings?
|
 |
Matt Josh
Greenhorn
Joined: Mar 16, 2011
Posts: 3
|
|
In database I have 207306 rows for Entity as part of process I have to read all this data and put to some cache.
Is it possible to implement some kind of paging or slicing which automatically fetch x number of rows get result which I can save in cache
again make call to get fix number of data.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Do you have to put all 207306 rows in the cache? If so, paging will not help - you need a much bigger heap or a disk based cache.
|
 |
 |
|
|
subject: Heap exception while loading complete table data from database
|
|
|