• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError: Java heap space

 
Darren Carter
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eveyone,

really need some help with this.

I am receiving the memory error while trying to retrieve a record from the database in my spring rest api. The object am retrieving has a one to many relationship.

The Stack trace



The Hibernate mapping


The DAO



I am running this as an integration test via spring test. Ive checked my eclipse.ini and have plenty or perm gem space i.e -XX:MaxPermSize=2048m

Can anyone help?

Regards
Darren
 
kri shan
Ranch Hand
Posts: 1479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate version ?
 
Darren Carter
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The version of hibernate is 3.6.10.

To provide further information on this issue. The out of memory was due to hibernate returning hundreds of thousands of rows for my sky subscription list. I checked this by doing a lazy load on my List and checking the list size.

In the H2 database I have only one user account, with only one associated sky subscription.

I changed the sky table to include an auto increment id (which is now pk) and have a unique key of sky_viewing_card_id.

Findings

When my "one to many" mapping in user_account looks like this, it returns hundreds of thousands of skysubscriptions:



However, when I change the list-index column to active, it returns the one association -Great!.

So what I want to understand is
1) why does hibernate do this when it indexs my unique key? <list-index column="sky_viewing_card_id"/>
2) when I change to <list-index column="active"/>, it returns a list count of 2 entries - One is my skysubscription and the other is null.. what does it return a null record?

Thanks for the help, and im wondering if using HQL would be a better option?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic