-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HowTo partial Persist BIG Datastructures?
PostPosted: Fri Feb 20, 2009 1:31 pm 
Newbie

Joined: Fri Feb 20, 2009 12:55 pm
Posts: 1
Hi,

I have a problem with persisting a big ObjectTree.

The Object Tree is fairly simple:

Code:

---------       ---------       ---------
I       I 1   * I       I 1   * I       I
I   A   I-------I   B   I-------I   C   I
I       I       I       I       I       I
---------       ---------       ---------


A is having an ArrayList of Bs and B is having an ArrayList of Cs.

Our Code is reading files, and starts to build up the Objects from those Files. Normaly after all Objects are build the Objects are persistet to an Oracle DB.

As the input may be rather large, the JVM is running low on memory. We use this inside a Websphere 6 Container, but without Entity Manager, just Hibernate Core in Version 3.2.6 with JAVA 1.4.2.

As there is just 1 A Object, a few B Objects but many and large C Objects, I wanted to persist a B Object and all attached C Objects then clear the ArrayList so that JAVA can free this memory, as the Objects are already persisted.

In order to do so, I have set the Cascading of Bs List of Cs to EVICT, and As List of Bs to NONE.

Then I succeded only by doing the following sequence, not to loose the references between B and Cs.

beginTX()
Create A Object
....Create B Objects
........ Create C Objects and fill in all Data, Save each C
........ Add all C Objects in a list and set it in B
.... Save B
Save A
Flush
commit();

In order do remove the space using Object I used the following procedure in between the above code:

Iterate through all processed B Objects
....Iterate through all included C Objects
........evict(c);
....clear() List of Cs in B
....evict(b);

Actually this procedure works to keep the integrity of the persisted Objects.

BUT: Hibernate obiviously keeps a reference to the deleted Objects (C), even when evict() is used. Calling Garbage Collection and Finalization does not free memory just until the Session has been closed.

Is there any prefered way in solving such a problem. I have searched the Internet and the Hibernate Documentation, but I was not able to find a solution.

Any other procedure than the obove stated was noticed by Hibernate, and as a result all references between B and C Objects in the DB were NULL.

Thanks a lot in advance.

Best Regards

SPOT.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.