-->
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: Truncating table behavior with SQL Server
PostPosted: Fri Feb 06, 2004 3:26 pm 
Newbie

Joined: Wed Aug 27, 2003 5:21 pm
Posts: 7
Hi there,

I have a table in SQL Server that gets loaded with data, wiped out, reloaded, etc. many times during a single day. I'm using Hibernate to manage it, but am worried about the value of the primary key column increasing ad infinitum.

I noticed that by issuing a "truncate [tablename]" call to SQL Server, it actually resets the counter on the ID column. Is there an equivalent way to do this vis a vis Hibernate? If not, can I just call "truncate [tablename]" through Hibernate's session and assume that Hibernate will figure out that all of the objects have been deleted (as opposed to doing a delete where the HQL string is "from [class]")?

Thanks in advance.

Adam Rice


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2004 4:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can execute your SQL through session.connection(). Be sure however to flush all caches (both session level and JVM level if you use it)


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.