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.  [ 5 posts ] 
Author Message
 Post subject: HQL Update Syntax For Components
PostPosted: Fri Dec 02, 2005 12:10 pm 
Newbie

Joined: Thu Apr 15, 2004 4:16 pm
Posts: 6
We are running into a problem with a relatively simple use-case.

Let's say that we have a class called Parent that defines a property called 'component' to reference a 'Component' class. It is mapped in hibernate using the '<component>' element.

How can one write an HQL batch update that will work against the properties contained in the component? I've tried the following to no avail:

- 'update Parent set component.property1 = :property1'
- 'update Parent set property1 = :property1'
- 'update Parent set Parent.component.property1 = :property1'

I was hoping that someone could point me in the right direction.

Appreciate the help,
Amit


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 12:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Try:

Code:
update Parent p set p.component.property1 = :value


Make sure you are using the latest release of HB 3.1.


Right, steve?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 12:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Actually either form works:

update Parent p set p.component.property1 = :value
update Parent set component.property1 = :value

The later is equivalent to your first attempt, so not sure why this would fail. What version are you using? What is the exception?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 12:37 pm 
Newbie

Joined: Thu Apr 15, 2004 4:16 pm
Posts: 6
Worked!

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 12:38 pm 
Newbie

Joined: Thu Apr 15, 2004 4:16 pm
Posts: 6
I was using 3.0.5.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.