openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: @PersistentCollection question
Date Mon, 23 Feb 2009 16:27:13 GMT
+1 on option (a) as well.  Since we already have tests for the @OrderColumn
mechanism, let's not duplicate that effort.

On Mon, Feb 23, 2009 at 10:17 AM, Jeremy Bauer <techhusky@gmail.com> wrote:

> Tim,
>
> I think you've found a valid problem in the test cases.  The basic use of
> PersistentCollection does not enforce ordering so results will vary for
> each
> database.
>
> Depending on what is being tested you could:
>
> a) Modify the validation code to validate the collection based on
> non-deterministic ordering of data.  This may be the best option since the
> OpenJPA execution path being tested is the same.
>
> b) Add explicit column ordering using @OrderBy.  This requires the use of a
> persistent field/property that is order-able.  Possibly the Id field?  This
> also requires that the elements in you your list are in that order.  Might
> be get kind of messy - and this changes the OpenJPA execution path.
>
> c) As Pinaki mentioned, use synthetic ordering.  This can be achieved with
> @OrderColumn.  An 'order' column will be added to the collection table and
> OpenJPA will use this column to manage the order of the collection.  If
> changing the execution path isn't a big concern, this is likely the best
> option.  However, OpenJPA has OrderColumn specific tests, so I vote for
> option a) to keep the non-ordered path(s) covered, if possible.
>
> -Jeremy
>
> On Mon, Feb 23, 2009 at 8:41 AM, Pinaki Poddar <ppoddar@apache.org> wrote:
>
> >
> > afaicr, OpenJPA was maintaining ordering for elements for field that is
> > declared (or even instantiated) as java.util.List. It has the capability
> of
> > creating synthetic column to maintain element ordering even when @OrderBy
> > or
> > some other ordering spec is absent.
> >
> >
> >
> >
> > Tim McConnell wrote:
> > >
> > > Hi, I see a number of inconsistencies in the OpenJPA Junit testcases
> > > concerning
> > > the usage of the @PersistentCollection annotation on a java.util.List
> > > variable
> > > without the @OrderBy annotation. If I'm interpreting this scenario
> > > correctly,
> > > without the @OrderBy annotation there is no column in the database used
> > > for
> > > ordering when retrieving the List back into memory, and thus there can
> be
> > > no
> > > assumption made about that order in the testcase. This appears to be
> why
> > > these
> > > testcases work on some database and not others (e.g., works on Derby,
> > > fails on
> > > PostgreSQL). Am I interpreting it correctly ?? Or am I missing
> something
> > > obvious ??
> > >
> > > --
> > > Thanks,
> > > Tim McConnell
> > >
> > >
> >
> > --
> > View this message in context:
> >
> http://n2.nabble.com/%40PersistentCollection-question-tp2369556p2372385.html
> > Sent from the OpenJPA Developers mailing list archive at Nabble.com.
> >
> >
>

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