openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Judes Tumuhairwe" <>
Subject Re: How to annotate a positional List
Date Wed, 08 Oct 2008 14:22:34 GMT
Hi Kevin,
Ordered lists (where the order is important and persistible) are not part of
the JPA 1.0 spec. They are planned for the JPA 2.0 spec.
Linda DeMichiel (the JPA spec lead @ Sun) gave an overview of it at the
JavaOne this year [1] (page 22+ of the PDF presentation/slides talk about
Since the spec is not yet final, I doubt that OpenJPA implements it but I
could be wrong (can anyone from the dev-team confirm this or give an
estimated date if planned?).


Judes Tumuhairwe

On Tue, Oct 7, 2008 at 10:58 PM, Kevin Cox <> wrote:

> Hi,
> I have been searching the manual, examples, and mail lists for an
> implementation of a List, where the items in the list are positional stable
> after the commit.  I¹ve had no luck and I am now wondering if it exists.  I
> imagine it would need to otherwise nobody could properly store an ArrayList
> using OpenJPA!  (should be basic stuff) Hibernate does this using
> <list-index column="position"/>
> Here¹s the problem.  Let¹s say I have a contrived Book object which has a
> List (ArrayList) of pages (Page objects).  The pages in the List need to
> maintain their order. Page 1,2,3,4 etc.  The order is maintained by using a
> position or sequence number which is used to sort the list.
> The db scheme would be something like
> Create table book (
>    book_id number,
>    title varchar
> )
> Create table page (
>    page_id number,
>    page_data clob
> )
> And here¹s the link table
> Create table book_page (
>    book_id number,
>    page_id number,
>    sequence number  <<<<--- the position or sequence number 1,2,3,4,5,etc
> ) -- all not null
> The Collection annotations for List need to automatically insert and update
> the sequence numbers to make the ArrayList maintain stable order upon
> commits.  The sequence needs to be incremented and decremented for List
> adds
> and removes and renumbered for mid-list insertions and removes.
> Does anyone know how to implement this in OpenJPA?  Is it supported?  It¹s
> really just maps a java List to a db schema, keeping the list items order
> stable during persistence.
> Thanks,
> Kevin

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message