Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Order by association key fields not working(with criteria api)

Hi,
i want to create a query that orders by several fields including foreign key fields of associations.
This worked fine with openjpa, but eclipselink generates wrong SQL.

I have an Entity A with a manyToOne asscoiation to entity B.
I order by A_.normal_field, A_.b, and ecliselink genereates "oder by normal_field ASC, ASC", so it leaves the second order by empty where it should put "b_id", the respective column name.

A workaround probably would be a join, however this is not an option to me as a join is too costly and should not be needed here.

I wonder if i could put an additional "b_id" field to entity A which refers to the same column as the association or if that could lead to further trouble :)

In the end i think this is a bug though and i should probably report it in the tracker!?

Michael


Back to the top