Hi Andy, On Jun 20, 2009, at 2:52 AM, Andy Jefferson wrote:
http://issues.apache.org/jira/browse/JDO-633 Don't know how to do thissince the absolute order is not required to be in the database, but there might be a way to create the database language (e.g. SQL) to do an ordered subselect and choose the "nth" item from the selection? Database-specific SQL? Can we support this in all databases? Is there a use-case?Don't understand. A List has an order (whether it is an "indexed" List, or an "ordered" List (using JPA-style ordering criteria)). The user puts items in the List and persists the List. The user then wants to grab element atindex 2.
JDO doesn't require that absolute numbers be stored. So the item at index 2 might have a row order value of 17. It's only in index position 2 because there's also a row with row order value 3.
What I was (am) concerned about is that in order to get to the item at index 2 an ordered subquery might be needed, and didn't (don't) know the complexity for all the use cases to get the right answer.
If you're happy with implementing this, considering all the possible places where get(2) might be used, then I'm happy. ;-)))
Craig
Storing the order in the datastore, in some way, is essential tosupport (indexed) Lists, hence querying should be straightforward. Since JDO doesn't define an ordering constraint, it is reasonable to assume that in JDOa List is an "indexed" List, hence retains the users ordering.As far as testing goes, surely all you need to do is persist an object with a List with some elements in some order, and then do a query, assuming the same order as they had at the moment of persistence. Where does DB- specific SQLcome into this ? surely that is the problem for the implementation. -- Andy (DataNucleus - http://www.datanucleus.org)
Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:[email protected] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
