-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate Deletion operation performance
PostPosted: Fri Jan 09, 2004 1:58 pm 
Newbie

Joined: Fri Jan 09, 2004 1:34 pm
Posts: 2
Hibernate requires a load, create, or store operation to occur before a delete can be issued. That means, I think, a SQL SELECT or INSERT has to happen before a SQL DELETE can be issued in the background. Isn't this SQL SELECT or INSERT reduntant since most of the times in the application you know that what you are deletind exists in the DB? Does't application performance hurt.

Thanks

Jamal


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 2:07 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
But Hibernate has to cascade operations and run other lifecycle methods. It has to have an object in the Session before the object can be deleted. This is of course bad for mass deletes, which is why you should not execute mass operations (including UPDATEs) with Hibernate, but use direct SQL calls. Usually, this is a rare case in most applications that use object/relational mapping.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 11:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually, it is quite acceptable to do:

Code:
Session session = sf.openSession();
session.delete(detachedObject);
session.flush();
session.connection().commit();


So, in fact, no SELECT is needed.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 11:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Note that what I just said does not contradict what Christian said.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.