On Wed, Feb 29, 2012 at 12:06 PM, Pinaki Poddar <[email protected]> wrote:
> > Extra performance cost that comes as a price for just wanting to use List > API. > That is not a sound argument. > I would compare this to coming into a store, and selecting between alarm clocks. There is a $9.99 clock that displays time and beeps for alarm, and there $49.99 clock that does the same plus auto-adjusts the time, has FM/AM/CD/Sattelite receivers, and makes you coffee. The thing is that I only wan the auto-adjust feature, and nothing else, but I'm placed in a position that if I do want it, I have to get a fully loaded one, and pay the maximum price. Firstly, a performance cost is not a bug. > Secondly, a feature i.e. to have List maintain order, it is natural that a > provider will need some code and code costs. But that cost can not be > termed > as a performance cost. That is a feature cost. > There is a cost to maintain order across a single context, and a [much?] higher cost to maintain order across contexts. Users are forced to pay higher cost, even if all they want is a simpler feature. This is effectively paying for stuff you don't need because of the stuff you do need. And the spec seems to agree, saying that you if all you did is requested the simpler feature (declared your collection as a List), you are are not entitled to get a more advanced behavior (maintaining order across contexts), and if you do, you have to explicitly request for that. > > With current capabilities of OpenJPA, a user determines and has complete > control on whether s/he wants Set or List to represent a domain model > properties. If a user does use List API it means s/he requires ordering > semantics. And that declaration is sufficient for OpenJPA to maintain > element ordering for him/her. So what is the confusion about "just wanting > to use List API"? > > I [might] want to use List API to make calls like get(int), and use list iterators that allow me to traverse the list both ways. I do care that the order of elements doesn't change between me creating iterators of a the same list, or accessing items in the same list (so get(i) always returns the same object). It doesn't mean that I want and/or care for the framework to guarantee all that across persistent contexts. If I did, I would specify @Order? annotation.
