Hi all,

How can I avoid INNER JOINs to be generated for tables stated in ORDER BY clause?

For instance, EJB QL

  select p
    from Person p
   order by p.idPlaceOfBirth.name

results in SQL which INNER JOINS Person and Place, and the persons without known place of birth (id_place_of_birth == null), are not listed.

The only solution I found so far is to explicitly use

  select p
    from Person LEFT OUTER JOIN p.idPlaceOfBirth b
   order by p.idPlaceOfBirth.name

But it tends to unnecessarily add to the EJB QL queries complexity.

Is there any other way to do the same thing?

Regards,
Ognjen

Reply via email to