Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Heap exception while loading complete table data from database

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are already using lazy initialization. Could it be that you just don;t have enough heap space to load all Entity records?
 
Matt Josh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to set Lazy loading for OneToOne mapping ojects?
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but you are not using OneToOne mappings?
 
Matt Josh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
reply
    Bookmark Topic Watch Topic
  • New Topic