Re: Cayenne for SIM-like game

From: Dave (sanxion200..ahoo.com)
Date: Mon Dec 20 2004 - 15:36:49 EST

  • Next message: Mike Kienenberger: "Re: Cayenne for SIM-like game"

    Dave wrote:
    > Are DataObject instances copied in
    > the DataContext.localObjects() method?
    > I'm worried about any custom fields not
    > part of the values Map.

    Mike wrote
    > Yes, it will create a new data object pointing at
    the same database record.
    > What sort of fields do you have that you're not
    persisting?

    Non persistant fields that only are relevant to the
    ongoing session. E.g. if the Player has joined a
    ChatRoom, any movements, moods and so on.
    They add up to become quite a few. From what I
    understand there are several possibilities. Let me see
    if I understand them.

    POSSIBILITY 1
    Mike wrote:
    "you might create a server object that internally
    delegates to a cayenne object for persisted values"

    I'm not sure I understand how this would solve the
    problem with copies? I need a Context in the main
    thread that loads the game, all cities, houses, rooms
    and furniture.
    To safely update them, as we've discussed, I need to
    move them to a seperate context with localObjects().
    Hm. Is there something I'm missing?

    POSSIBILITY 2
    Mike wrote:
    "Another possiblity is to create your own
    localObjects() method that calls the cayenne method,
    then calls your custom code to copy over your
    non-persisted values afterward."

    I guess the main Context should keep track of ALL the
    loaded instances of Player, City, House, Room and
    Furniture. Any other contexts, residing in Player,
    should only be used for updating rows. In that case
    I'm not sure I need my non-persitant fields copied.
    I could create a copy of the object I wish to update
    using localObjects() in the player Context. Change
    persistant fields. Commit changes. Probably unregister
    the object in the player context, as it was temporary
    anyway. Is this a way to go?

    POSSIBILITY 3
    Dave wrote:
    "use the extended class generated by cayenne for my
    custom fields and methods"

    I'd really like to do this. Perhaps this works with
    what is described above? Are there any other options
    we've overlooked? Or am I ready to charge ahead?

    Thanks,
    Dave

                    
    __________________________________
    Do you Yahoo!?
    Read only the mail you want - Yahoo! Mail SpamGuard.
    http://promotions.yahoo.com/new_mail



    This archive was generated by hypermail 2.0.0 : Mon Dec 20 2004 - 15:36:52 EST