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.  [ 3 posts ] 
Author Message
 Post subject: HQL example needed in XDoclet tag
PostPosted: Fri Dec 16, 2005 12:54 am 
Newbie

Joined: Fri Dec 16, 2005 12:31 am
Posts: 6
Hi -

I am using Hibernate 2.1.6 and would like to to build a query in HQL for the following SQL query:

select emp.Name from EMPLOYEES emp
inner join EVENTS v
on emp.GROUP_ID = v.GROUP_ID

The tables are:

EMPLOYEES: columns> Name, GROUP_ID
EVENTS: columns> GROUP_ID, EventName

This basically joins the two tables EMPLOYEES and EVENTS on their comment column GROUP_ID.

What could the HQL query for this in XDoclet look like?

I tried the following and it doesn't work:

@hibernate.query name="myQuery" query="from EMPLOYEES as emp join EVENTS as v on emp.GROUP_ID = v.GROUP_ID


I get the following exception:

"Caused by: net.sf.hibernate.QueryException: outer or full join must be followed by path expression "

Any help will be appreciated! Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 16, 2005 3:16 am 
Newbie

Joined: Sun Aug 07, 2005 3:55 am
Posts: 11
Location: slovakia
OK, so if we propose Your mapped object classes are (EMPLOYEES and EVENTS) ... because it is the object names that matter not the table names ?! ... than I would give it a try to remove the alias for the JOIN Class (I had some issues with aliases in Hibernate 3.0.x ... but I am absolutely not sure if this is Your problem):

Code:
SELECT emp.Name FROM Employees emp
INNER JOIN Events ON GROUP_ID = emp.GROUP_ID


of course this proposes than Employees object does have an GROUP_ID property (CASE SENSITIVE ?) etc.

_________________
JK@res


Top
 Profile  
 
 Post subject: Classes are not mapped
PostPosted: Fri Dec 16, 2005 11:20 am 
Newbie

Joined: Fri Dec 16, 2005 12:31 am
Posts: 6
EMPLOYEES and EVENTS are two classes that are not mapped.
I've seen a lot of examples from the Hibernate reference guide for objects that have a parent to child relationship but my two objects are not mapped. Hence I am trying to come up with a query for the @hibernate.query tag.
Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.