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: HQL joins
PostPosted: Mon Aug 07, 2006 6:44 am 
Beginner
Beginner

Joined: Wed Apr 26, 2006 4:12 am
Posts: 29
I want to do an HQL inner join from one table to another. The join is on two fields which don't actually have a mapping relationship defined for those fields. Think of it as an arbitrary join that I only want to do for this particular query, but I don't require a relationship mapped for it in their mapping files.

The thing is, Hibernate then bitches about this and the only way round it is to define a one-to-one mapping and the join works. Is this expected behaviour?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 07, 2006 8:53 am 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
yep, this is the expected behaviour from HQL. Keep in mind that HQL operates with persistent objects and their relationships not with tables, columns or foreign keys. This implies that every property or association you want to use in your HQL query must be mapped. But you can always use plain SQL in your queries instead of HQL - check the docs.

HTH,
radu


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.