Possible bug with CriteriaBuilder

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible bug with CriteriaBuilder

Jean Morissette
Hi dear EclipseLink developers,

I'm using EclipseLink (version 2.6.4) CriteriaBuilder API to build a left-outer-join with an order-by clause. However, it produces an inner-join query instead of a left-outer-join. 

You can take a look at this example to reproduce the problem: 


Hibernate produces the expected result.

Please, could you confirm it's effectively a bug, when it should be fixed and if a workaround exists in the meantime.

Thank you,
Jean


_______________________________________________
eclipselink-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
Reply | Threaded
Open this post in threaded view
|

Re: Possible bug with CriteriaBuilder

christopher delahunt
This isn't a bug. When you pass true into your method it uses the following code
if (orderByAdvisorName) {

criteria.orderBy(cb.desc(from.get("advisor").get("advisorName")));
}

from.get("advisor") is causing an inner join as required by the spec.  You should reuse you left outer join instead:
criteria.orderBy(cb.desc(join.get("advisorName")));


Best regards
Chris

On May 20, 2017, at 6:22 PM, Jean Morissette <[hidden email]> wrote:

Hi dear EclipseLink developers,

I'm using EclipseLink (version 2.6.4) CriteriaBuilder API to build a left-outer-join with an order-by clause. However, it produces an inner-join query instead of a left-outer-join. 

You can take a look at this example to reproduce the problem: 


Hibernate produces the expected result.

Please, could you confirm it's effectively a bug, when it should be fixed and if a workaround exists in the meantime.

Thank you,
Jean


_______________________________________________
eclipselink-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev