cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Murphy <>
Subject Re: Insert at a particular position in the detail list
Date Thu, 25 Sep 2008 23:41:08 GMT

My problem has nothing to with the storage of rows in the database. 
Things work fine after a database refresh (the Strandz framework takes 
care of that).

I just want to insert at a particular point in the detail list. If this 
can be achieved then the user can navigate around the DO graph and come 
back to the DO he inserted - and it will still be in the place where he 
put it. That's all I want!

Anyway the solution for ROP would seem to be the same as for server DOs. 
I have written this extra method in the client version of Worker:

     * Copied from super and altered to allow adding at a particular point
    public void addToRosterSlots(RosterSlot object, int index)
        if(objectContext != null) {
            objectContext.prepareForAccess(this, "rosterSlots");

        this.rosterSlots.add( index, object);

The only changes I am making in these extra methods is that I am using 
add(index, object) rather than add(object). Wouldn't it be a good idea 
for the generated methods to have the extra int argument?

- Chris

Scott Anderson wrote:
> If you put a new entry in the middle of the list, it's still going to
> boil down to a vanilla INSERT. Since DB tables are FIFO, your row will
> jump to the end of the list the after a refresh.
> If order is important to your application, you'll have to come up with a
> way that the database will respect. That could mean, among other things,
> sorting on a field, or using relationships to daisy-chain the records
> like a linked list.

Seaweed Software Pty Ltd,

View raw message