-->
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.  [ 3 posts ] 
Author Message
 Post subject: Delete with Query.executeUpdate does not actually delete fro
PostPosted: Tue Apr 19, 2005 2:48 pm 
Newbie

Joined: Mon Apr 18, 2005 11:27 am
Posts: 3
Hi,
I started to use H3, previously I was using H2.1.
I want to do a delete with Query.executeUpdate() method, while other delete methods in Session are obsolete. Actually everything goes fine, I don't get any exceptions when running this method, and return value actualy shows correct number of records to be deleted regarding the WHERE condition, but in database nothing changes. Those records are still there.
What am I doing wrong?

Hibernate version:H3


Code between sessionFactory.openSession() and session.close():
String delQueryStr =
"DELETE sample.Test WHERE changeFlag = :flag";
Query delQuery = sess.createQuery(delQueryStr);
delQuery.setParameter("flag", changeFlag,Hibernate.STRING);

log.debug("deleteWhereChangeFlag(): delQuery = " + delQuery.toString());
int delCount = delQuery.executeUpdate();

Name and version of the database you are using:
DB2 version 8.1


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 19, 2005 6:51 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
commit your transaction.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 20, 2005 3:16 am 
Newbie

Joined: Mon Apr 18, 2005 11:27 am
Posts: 3
Of coures. Stupid me. I almost moved to JDBC connection in case of delete more records at once.

Thanks


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