-->
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: Update data using criteria
PostPosted: Thu Jun 14, 2007 7:14 am 
Newbie

Joined: Sun Dec 10, 2006 3:40 am
Posts: 4
I have a search criteria, i want to change a value in all the objects returned from the criteria

SQL:
UPDATE set val='new' where "dynamic search criteria'

Is there any way to do it using Criteria API ?

If not i have some workaround:

I getting all the ids of the objects that need to be changed using the criteria :

This is my HQL:
"update Object o set o.val = :val where o.id in (:ids) "

But I dont know how to insert the ids now - the ids are of type Long
I have an arraylist of them?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 10:18 am 
Newbie

Joined: Sun Dec 10, 2006 3:40 am
Posts: 4
The following method can be used for the second option:
setParameterList


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.