Order By Child Column modifies Join Order

View: New views
2 Messages — Rating Filter:   Alert me  

Order By Child Column modifies Join Order

by tch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We're getting some odd behavior:
Some JPQL like this

Select parent.label, child.label2
FROM parent
LEFT JOIN child

With the expression API if we add an order on child.label2, the query
is rewritten like this:

Select parent.label, child.label2
FROM child
LEFT JOIN parent
order by child.label2

Is there some hint that we have to use to tell EL to not rewrite like
this when ordering by a child column? Obviously query 2 is very
different from query 1.

Thanks

./tch
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Re: Order By Child Column modifies Join Order

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not sure if these are JPQL, or SQL, they don't look like valid either.

Could you include the real code to the queries you are executing, and the real SQL that EclipseLink is generating.


tch wrote:
We're getting some odd behavior:
Some JPQL like this

Select parent.label, child.label2
FROM parent
LEFT JOIN child

With the expression API if we add an order on child.label2, the query
is rewritten like this:

Select parent.label, child.label2
FROM child
LEFT JOIN parent
order by child.label2

Is there some hint that we have to use to tell EL to not rewrite like
this when ordering by a child column? Obviously query 2 is very
different from query 1.

Thanks

./tch
_______________________________________________
eclipselink-users mailing list
eclipselink-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/eclipselink-users