bharal
bharal

Reputation: 16204

Hibernate, what is the difference between "on" and "with" in a join clause?

In hibernate, I can have a join clause:

from Product p
left join Family f on f.z = p.q

Or I can write

from Product p
left join Family f with f.z = p.q

What is the difference?

Upvotes: 1

Views: 33

Answers (1)

Sachin Sharma
Sachin Sharma

Reputation: 51

WITH clause is used for subquery factoring and also known as common table expressions.

Syntax: WITH tempTable_Name AS (SELECT column_Name..... FROM table_Name)

ON clause is used to join columns that have different names

Syntax: SELECT * FROM table T1 LEFT JOIN table T2 ON T1.column_Name = T2.column_Name

Upvotes: 1

Related Questions