I am trying to perform right outer join in HQL. Query creation is done as mentioned below:
Query query = this.sessionFactory
.getCurrentSession()
.createQuery(
"select O.customer.id as id, O.customer.firstName as firstName, O.customer.lastName as lastName, O.customer.address as address, O.customer.city as city, count(O.id) as totalOrders from Order O right outer join O.customer group by O.customer.id");
SQL query on mysql is working fine, but the HQL query is returning the result for inner join.
SQL query is:
select c.id,
c.firstname,
c.lastname,
c.city,
count(o.id) as total_order
from orders o right outer join customers c
on c.id = o.customer_id group by id