-->
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 whilst joining
PostPosted: Mon Aug 22, 2005 6:59 am 
Newbie

Joined: Thu Jun 30, 2005 6:36 am
Posts: 4
Basically i want to update a status flag on all rows in one table based on a join on another table...

for eg in SQL

update TABLE_1 as A inner join TABLE_2 as B on A.table2_id = B.id set A.status = 2 where B.status = 9

so my guess in HSQL was along the lines of..

update TABLE_1 tb1 left join fetch tb1.table2 set tb1.status = 2 where tb1.table2.status = 9

however i'm getting errors saying that 'set' was expected.

is it possible to update one table whilst joining on another in HSQL...?

p.s - seems you can't run update statements in SQLQuery's either so i am a little stuck at the moment?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 8:27 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
See 11.5. Modifying persistent objects:
http://www.hibernate.org/hib_docs/v3/re ... -modifying

See 14.3. Bulk update/delete:
http://www.hibernate.org/hib_docs/v3/re ... tch-direct

See Chapter 17. Native SQL:
http://www.hibernate.org/hib_docs/v3/re ... /#querysql

Note that for some features you need to run a recent version of Hibernate (3.0.5 resp. 3.1).

Best regards
Sven

_________________
Please don't forget to give credit, if this posting helped to solve your problem.


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.