-->
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: Update query se detiene
PostPosted: Wed Mar 10, 2010 1:13 pm 
Newbie

Joined: Fri Jun 08, 2007 8:07 am
Posts: 4
Hello.

I'm trying to make a query in HQL update I do a join in a subquery (as the manual is permissible). I make this query:
---
Code:
update A set a.b = :bNewValue
where id in (select a2.id from A a2 where a2.fieldObject.field = :filterValue)

---
and gives no fault, but implementation remains blocked and not running the following sentence of execution.


Top
 Profile  
 
 Post subject: Re: Update query se detiene
PostPosted: Thu Mar 11, 2010 4:01 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
implementation remains blocked


Please perform
jstack <your_jvm_pid>
while your implementation remains blocked and report the output.
Then we should see where the implementation hangs (probably it is the database which waits on some lock release).


Top
 Profile  
 
 Post subject: Re: Update query se detiene
PostPosted: Thu Mar 11, 2010 5:00 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I suspect it is the database that is the problem. When I try a similar query in MySQL I get an error message:

Code:
ERROR 1093: You can't specify target table 'News' for update in FROM clause


You may have to run the subquery first and load a list with the id:s and then run the update query with the list as a parameter.

Code:
update A set a.b = :bNewValue where id in (:listOfIds)


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.