-->
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: Path expected for join!
PostPosted: Thu Jun 25, 2009 5:43 am 
Newbie

Joined: Tue Jun 03, 2008 3:53 am
Posts: 3
Dear all,

In the context of Hibernate, I met a problem and I hope I might get an answer from java forum as most of you are also good at Hibernate and SQL.

In most cases, we have a join of two tables which have a direct reference (FK -> PK), this makes HQL easy as follows:

Code:
SQL:
SELECT *
FROM   employee
       INNER JOIN department
          ON employee.DepartmentID = department.DepartmentID


HQL:

Code:
select * from Employee as employee inner join employee.department



Now assume that we want to make a join of two tables which have not direct reference, for example,

Code:
SELECT *
FROM   employee
       INNER JOIN customer
          ON employee.Name = customer.Name


HQL:

Code:
select * from Employee as employee inner Customer as customer where employee.Name = customer.Name


The above gives an exception as “org.hibernate.hql.ast.QuerySyntaxException: Path expected for join!”.

Does it mean HQL does not support this kind of join (without FK – PK association)?

Regards.

Pengyou


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.