|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
One-to-Many ordered list not ordered when cachedHi all, I have a one to many mapping where the many objects should
be sorted by a query key. In my Eclipselink workbench I have set the Advanced Container
Options to List and java.util.ArrayList. The descriptor of my “many objects” calls an After
Load method that sets useTransparentCollection() and addAscendingOrdering(
"listSeqNo" ). I have a unit test that creates several instances of the “many
objects” and they are created with ascending values on the query key (called
“listSeqNo”) as expected. The unit test then commits the transaction and a subsequent
unit test then uses the objects, however the items are retrieved from the cache
and are no longer in sorted order. If I later retrieve the same items from the database via a
query the items are retrieved in correct order. I can not find a way to configure the cache to obey the
ordering as dictated by the query key. I have tried removing the addAscendingOrdering() from my
After Load method and setting it in the workbench on the one-to-many mapping (Ordering
tab), but this did not help. I have tried not using a transparent collection (in the
After Load method), but this did not help. I tried several combinations in the Advanced Container
Options without success, although I have not tried the TreeSet, since it is not
trivial to update our code. This is a new problem since migrating from Toplink 2.5.1 (ouch).
I have tried everything I can think of to try to get this working. I am using eclipselink-incubation-1.0M9, Java 1.5 and Oracle
9i. I have found some similar issues but am not sure if they are
the same cause, e.g. http://forums.oracle.com/forums/thread.jspa?messageID=2571698 Please help with suggestions or information. Regards Tim. _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: One-to-Many ordered list not ordered when cachedHello Tim,
Only the OrderedListContainerPolicy EclipseLink container policy will attempt to maintain order when merging into the cache. To use it, try: ((CollectionMapping)mapping).setContainerPolicy( new OrderedListContainerPolicy(concreteContainerClass) ); This requires that you use a List implementation (such as Vector) for your container class. Best Regards, Chris Tim Bruton wrote: > > Hi all, > > I have a one to many mapping where the many objects should be sorted > by a query key. > > In my Eclipselink workbench I have set the Advanced Container Options > to List and java.util.ArrayList. > > The descriptor of my “many objects” calls an After Load method that > sets useTransparentCollection() and addAscendingOrdering( "listSeqNo" ). > > I have a unit test that creates several instances of the “many > objects” and they are created with ascending values on the query key > (called “listSeqNo”) as expected. > > The unit test then commits the transaction and a subsequent unit test > then uses the objects, however the items are retrieved from the cache > and are no longer in sorted order. > > If I later retrieve the same items from the database via a query the > items are retrieved in correct order. > > I can not find a way to configure the cache to obey the ordering as > dictated by the query key. > > I have tried removing the addAscendingOrdering() from my After Load > method and setting it in the workbench on the one-to-many mapping > (Ordering tab), but this did not help. > > I have tried not using a transparent collection (in the After Load > method), but this did not help. > > I tried several combinations in the Advanced Container Options without > success, although I have not tried the TreeSet, since it is not > trivial to update our code. > > This is a new problem since migrating from Toplink 2.5.1 (ouch). I > have tried everything I can think of to try to get this working. > > I am using eclipselink-incubation-1.0M9, Java 1.5 and Oracle 9i. > > I have found some similar issues but am not sure if they are the same > cause, e.g. > > http://forums.oracle.com/forums/thread.jspa?messageID=2571698 > > Please help with suggestions or information. > > Regards Tim. > > ------------------------------------------------------------------------ > > _______________________________________________ > eclipselink-users mailing list > eclipselink-users@... > https://dev.eclipse.org/mailman/listinfo/eclipselink-users > eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
| Free Forum Powered by Nabble | Forum Help |