-->
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 join through association table
PostPosted: Sat May 08, 2004 2:13 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
I have 3 tables: person, certification, pers_cert_assoc where person is associated to certification via the pers_cert_assoc.

I would like to use hql to select a set of persons who have a specific certification.

Here's my sql

select person.* from person, pers_cert_assoc, certification
where person.id = pers_cert_assoc.person_id AND
pers_cert_assoc.cert_id = certification.id AND
certification.type = "HQL Cert";

All tables have hbm.xml mappings with appropriate relationships.

I'm not sure where to start with expressing the join through the association table.

This is what I have so far

select pers.* from person as pers
join pers_cert_assoc as assoc
join certification as cert
where cert.type = :certType

The resultant error is:
"outer or full join must be followed by path expression"

Not sure what I'm doing wrong. I'll be glad to post my xml if needed

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 10, 2004 12:02 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
select pers from person as pers
join pers.pers_cert_assoc as assoc
join assoc.certification as cert
where cert.type = :certType

_________________
Emmanuel


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.