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: Delete query fire at the end of transaction
PostPosted: Thu Jan 29, 2009 2:07 am 
Newbie

Joined: Thu Jan 29, 2009 1:45 am
Posts: 1
Hi All,

Within a single transaction: internally the sequence hibernate fire the query cousing problem
Example:

When i do delete a record from TABLE1 and insert a new record in same table then hibernate always execute delete query at last.
But i need to execute delete query first then insert.
How do i do this?

Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 29, 2009 4:35 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
You can add an explicit call to Session.flush(). For example:
Code:
session.delete();
session.flush();
session.save();
session.getTransaction().commit();


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.