-->
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: hibernate update problem
PostPosted: Tue May 08, 2007 11:25 pm 
Beginner
Beginner

Joined: Sat Mar 03, 2007 5:32 am
Posts: 20
i would like to do something like this:
UPDATE thread SET status=3 where id in(1,2,3);

how can i run this query using hibernate. what is the alternative way to do it. thanks.


second problem:
how do i do update for both parent ad child table?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 09, 2007 9:32 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
http://www.hibernate.org/hib_docs/refer ... ryhql.html

First you need to query for objects with a specific id. You could use findById in your DAO for each one and add it to a list if it's just a short list. Otherwise you should really be search by some kind of criteria.

Then simply iterate over the list setting status to 3, and then pass each object to DAO.save(transiantInstance).

Hope that helps.

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


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.