Re: Auto-update between contexts

From: Dave (sanxion200..ahoo.com)
Date: Thu Dec 30 2004 - 03:29:27 EST

  • Next message: Williams, Beth: "Cayenne managed transactions vs. Container Managed"

    The code example in the prior mail contained some minor mistakes.
    I've corrected them, but the problem persists.

    Rergards, Dave

    // check the name of the player
    System.out.println("Name "+ player.getName());
     
    // --> This gives Ron
     
     
     
    // copy player object to temporary context
    DataContext context= DataContext.createDataContext();
    ArrayList list = new ArrayList();
    list.add(player);
    List localObjects = context.localObjects(list);
    Player playerCopy = (Player) localObjects.get(0);
     
    // update name and save changes
    protoCopy.setName("Dave");
    context.commitChanges();
     
    // check the name of the player
    System.out.println("Name "+ player.getName());
     
    // --> This gives Ron
     

                    
    __________________________________
    Do you Yahoo!?
    Yahoo! Mail - Helps protect you from nasty viruses.
    http://promotions.yahoo.com/new_mail



    This archive was generated by hypermail 2.0.0 : Thu Dec 30 2004 - 03:29:29 EST