-->
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: HQL UPDATE, NOT IN
PostPosted: Thu Apr 12, 2007 3:20 pm 
Newbie

Joined: Wed May 25, 2005 12:01 pm
Posts: 6
I am using Hibernate 3.2.3GA and I am trying to run the following HQL query (code):

Code:
List<PersonImpl> enabledPersons = new ArrayList<PersonImpl>();

...

Query q = QueryUtil.createHQLQuery("update PersonImpl p set disabled = true where externalDirectory = :ed and p not in (:enabledPersons)")
   .setEntity("ed", edi)
   .setParameterList("enabledPersons", enabledPersons);

List result = q.list();



While running this code I get exception:

Code:
Not supported for DML operations [update com.smthg.model.organization.PersonImpl p set disabled = true where externalDirectory = :ed and p not in (:enabledPersons0_, :enabledPersons1_)]



I am trying to "disable" PersonImpl objects which are not in enabledPersons List.

I am confused by the message in the exception: is this functionality not supported or am I doing something wrong?


Last edited by zagarb on Fri Apr 13, 2007 6:22 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 4:39 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
List result = q.list();

should be

int updates = q.executeUpdate();


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 5:53 pm 
Newbie

Joined: Wed May 25, 2005 12:01 pm
Posts: 6
OMG, of course, silly me! It works now, thank you!


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.