-->
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 query - must all tables be defined in XML config?
PostPosted: Tue Feb 26, 2013 4:01 am 
Regular
Regular

Joined: Tue Apr 10, 2007 10:02 am
Posts: 56
I'm using Hibernate with the XML file based configuration.

When building a HQL query do all entities/tables used in the query already have to be included in the XML configuration? In otherwords is it possible to introduce 'join' elements into a HQL query for associations that are not already defined in the XML configuration?


Top
 Profile  
 
 Post subject: Re: HQL query - must all tables be defined in XML config?
PostPosted: Wed Mar 06, 2013 3:02 am 
Beginner
Beginner

Joined: Wed Feb 06, 2013 2:43 am
Posts: 46
The answer is NO. you can't but with jist one exception

Hibernate does not define (left join on property = property) so you can 't build a join without mapping, but this has an exception (which i will cover below).

Exception for join:
But Hibernate does have a solution for your problem :
You can define your condition in where clause.
something like :
select a.*, p.* from Address a , Parent p
where a.studentNo = p.studentRefNo

So exception is you can have a inner join in this way without mapping.
And right, left and outer jons cant be acheived in this way.

_________________
Thanks,
Ajit Singh
ajits@mindfiresolutions.com
www.mindfiresolutions.com


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.