-->
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.  [ 7 posts ] 
Author Message
 Post subject: [performance] Remove all entries in a table?
PostPosted: Sun Sep 12, 2004 2:52 am 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
Hi,

I know about session.delete() but I don't want to remove each entry one at a time. How does one delete all entries in a table in one shot? This is known to be much faster in MySQL than individual deletes.

Gili


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 12, 2004 2:57 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
use JDBC.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 12, 2004 10:05 am 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
gavin wrote:
use JDBC.


Gavin,

So are you are saying that:

1) There is no way to do this in Hibernate code?
2) "delete from X" is portable across all databases?

Thank you,
Gili


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 12, 2004 10:18 am 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
gavin wrote:
use JDBC.


And while we're on the same page, I can't seem to find a reference in the FAQ or documentation on how to tunnel raw JDBC updates through an already-opened Hibernate session. Any idea how this would be done?

Gili


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 12, 2004 10:55 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
1) There is no way to do this in Hibernate code?
2) "delete from X" is portable across all databases?


1- orm = get object and then do what you want with them, if you don't need to get object, do it in jdbc, that's why orm is not a performant tool for massive delete/update
2- why this question?


Quote:
I can't seem to find a reference in the FAQ or documentation on how to tunnel raw JDBC updates through an already-opened Hibernate session.


http://www.hibernate.org/hib_docs/api/n ... onnection()

javadoc is good

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 12, 2004 10:57 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
session.connection() gets the underlying JDBC connection. Then use "truncate table myTable" which is portable across most if not all databases.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 12, 2004 11:48 am 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
Myk wrote:
session.connection() gets the underlying JDBC connection. Then use "truncate table myTable" which is portable across most if not all databases.


Thank you all.

Gili


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