How to change order in ordered+persisted collection?
I just need to change order of items in a (previously persisted) ordered collection...
I tried simply passing the re-arranged collection to a setter: after committing a transaction the collection is gone.
Then I tried to clear() the existing collection and addAll() afterwards: clear() makes persistent manager to mark all the elements as deleted. (But obviously I would like to be able to work with the collection items in the very transaction.)(The collection is not in a default fetch group, so I tried the above also with the named fetch group added into the fetch plan. No luck.)
Thi开发者_运维百科s must be the most stupid question, but I ran out of ideas and I'm stuck here two days already. I swear I googled. :(
The order of the data is set in an index. Unfortunately, the functionality to delete or reset the index is not currently there (How-to delete indexes in Google App Engine (Java)?.
It may be possible to dynamically change the index, however. Take a look at http://rahulswackyworld.blogspot.com/2010/03/dynamic-indexes-with-google-app-engine.html.
精彩评论