-->
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: Query on Composite Element, Return Type
PostPosted: Wed Jul 28, 2004 7:10 am 
Newbie

Joined: Wed Jul 28, 2004 6:48 am
Posts: 2
Hi,

I am quite new to Hibernate and am in need of assistance!

I am required to execute a Hibernate query on a Composite Element type (we'll call it C) contained in a Set under a standard Class mapping (we'll call it A). By reading the forums I discovered I can execute queries on composite elements using the 'join' HQL syntax. My query is shown below:

from A as <A shorthand> join A.C as <C shorthand> where <C shorthand>.parameter1 = :<test condition>

Although the above query executes correctly is always returns me an object of type A. This is not very helpful as getting an object of type A will only give me the entire set as stored in its Java object.

What I really need is the actual instance of object C where the query finds a match. Then if I have C.parameter2 I can read parameter2 where the query above matches C.parameter = :<test condition>.

Hope the above makes sense!

Cheers,

<Hibernate version 2.1.4>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 9:50 am 
Newbie

Joined: Wed Jul 28, 2004 6:48 am
Posts: 2
After reading further into the forums it seems 'mread' had a similar problem of querying composite elements:
http://forum.hibernate.org/viewtopic.php?t=924854&highlight=composite+element+query+type

And as a result of this forum post, the following feature request has been posted:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-513

I receive the same error of 'net.sf.hibernate.QueryException: could not resolve property: id of:' when trying to execute the following query in a vain attempt to retrieve my desired type composite element type - C:

select <C shorthand> from A as <A shorthand> join A.C as <C shorthand> where <C shorthand>.parameter1 = :<test condition>

Now I really don't want to have to alter my project's code design to work around Hibernate limitations, so are there any workarounds...or maybe I'm missing the obvious solution? Could a session query work directly on the set of C?

Can anybody please help me?


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.