tags:

views:

329

answers:

2

Using HQL, how do you join on columns (or object properties) that are non PK/FK?

I'm reading the docs, and it seems it implicitly is going to join on the PK columns right?

https://www.hibernate.org/hib_docs/nhibernate/html/queryhql.html

+1  A: 

HQL joins "implicitly" on foreign keys. If you don't have a (mapped) relation, just make a cartesian product and join in the where clause.

select order.id
from Order as o, Product as p
where o.productKey = p.Key
Stefan Steinegger
I see, just wanted to make sure you can do that with HQL.
yogurt
A: 

select order.id from Order as o, Product as p where o.productKey = p.Key

That would be an inner join, is there a way I can do a left outer using implicit join.

Taran Singh