-->
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.  [ 2 posts ] 
Author Message
 Post subject: Batch Inserts Problem
PostPosted: Thu Jun 14, 2007 5:39 am 
Regular
Regular

Joined: Mon Apr 02, 2007 3:54 am
Posts: 67
Location: Hyderabad
Hi All,


I am new to Hibernate. I am going through Batch processing concepts while reading about this. At the link given below
http://www.hibernate.org/hib_docs/v3/re ... batch.html
There is something specified at article 13.1 batch inserts like
session.flush();
session.clear();
My Ques is..... why are we using both at a time. can we not go for session.clear() only. As per me both are used to clear the session. I want to know that what benefit we are having when using both at same time.

Thanks,
Gopal


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 14, 2007 6:27 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Hi,
>>> As per me both are used to clear the session.
Incorrect.

Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.
Clear results in evicting all persistent objects in the session thus making that memory available for garbage collection.

In the above case, flush forces the session to issue insert queries while clear frees the in-memory imprint.

Benefits:
i) Less Memory.
ii) Scalable. ( no more OutOfMemory Errors )

This has been discussed many times in this forum.
You can have a look at them


-------------------------------------------
Rate the reply if you find it helpful


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

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.