GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes Heap exception while loading complete table data from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Heap exception while loading complete table data from database" Watch "Heap exception while loading complete table data from database" New topic
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.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Heap exception while loading complete table data from database