-->
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.  [ 1 post ] 
Author Message
 Post subject: can HQL handle fields starting with an underscore?
PostPosted: Fri Jun 17, 2005 6:16 am 
Newbie

Joined: Wed May 18, 2005 5:16 am
Posts: 3
Hi!

In my application I have two business Objects, namely Product and Resource. A Product can have zero or more Resources, and Hibernate has field access to them, i.e.:

Code:
Product {
    private Set _resources; 
}

Resource {
}


I would like to retrieve every Resource belonging to a Product in HQL. Why do the following queries don 't work?

HSQL: select _resources from Product

By Hibernate converted to the following SQL:

select product0_.productCode as col_0_0_ from products product0_

HQL: select p._resources from Product as p

By Hibernate converted to the following SQL:

select . as col_0_0_ from products product0_, resources resource2_, productresources _resources1_ where product0_.productId=_resources1_.productId and _resources1_.resourceId=resource2_.resourceId

The first SQL query is valid SQL, but does not retrieve the Resources. The last SQL query is just invalid SQL.

Am I doing something wrong? Is this a bug in Hibernate?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.