[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Order by association key fields not working(with criteria api)
|
Try adding an additional Basic mapping to the the b_id field and make it
read-only (updatable=false and insertable=false)
My reading of the spec suggests that the open jpa behavior goes beyond what the
spec requires (in pariticular, the spec requires that the elements of the order
clause be included in the select clause and the BNF suggests navigating to a
state_field which I do not believe a manyToOne qualifies as.). In my opinion,
however, this is a reasonable enhancement to request. (and the fact that we
don't give a reasonable error message is likely a bug). Please enter an
enhancement request.
-Tom
Michael Pflüger wrote:
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
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users