openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: How to use @OrderColumn values in SELECT
Date Mon, 04 Jun 2007 18:02:37 GMT
> But is there a way I could use this value (value of ORD column) in SELECT
> then? Eg. I would like to select all the requests for specific set of people
> but only those that are on the first position on their requests list.

Not directly, and this is by design. The JPA @OrderBy annotation is
defined in terms of your object model; the OpenJPA @OrderColumn
annotation is defined in terms of the relational model for situations
when you want to order by a column that is not mapped to a field in
the object.

However, with OpenJPA's partial-key joins, you could always create a
'firstRequest' relation, and then select that data in your query. See
http://openjpa.apache.org/docs/latest/manual/manual.html#ref_guide_mapping_notes_nonstdjoins
for details about partial-key joins.

-Patrick

On 6/4/07, Mariusz Lipinski <marioli@interia.pl> wrote:
>
> Hi,
>
> OpenJPA adds an extension to JPA spec allowing to persist List order in
> additional database table column. It goes like this:
>
>    @OrderColumn(name="ORD")
>    private List<Request> requests;
>
> But is there a way I could use this value (value of ORD column) in SELECT
> then? Eg. I would like to select all the requests for specific set of people
> but only those that are on the first position on their requests list.
> --
> View this message in context: http://www.nabble.com/How-to-use-%40OrderColumn-values-in-SELECT-tf3864133.html#a10946843
> Sent from the open-jpa-dev mailing list archive at Nabble.com.
>
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message