3

I have two POJO classes. One is EmployeeTO and another one is AddressTO.

EmployeeTO has one variable with name EmployeeId and AddressTO also has one variable with name EmployeeId. I want to apply a left join between EmployeeTO's EmployeeId and AddressTO's EmployeeId using HQL.

I used the following query.

from EmployeeTO employeeTO LEFT JOIN AddressTO addressTO ON employeeTO .EmployeeId=addressTO.EmployeeId

But it shows an error:

line 1:139: unexpected token: ON

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vishal Mittal
  • 41
  • 1
  • 7

1 Answers1

4

There is no ON clause in an HQL join:

from EmployeeTO e
left join e.addressTO

This assumes that your Employee entity class has an AddressTO field called addressTO.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360