Problems with DataContextDelegate

From: Claudio Rosati (claudio.rosat..csys.it)
Date: Wed Jan 05 2005 - 11:51:15 EST

  • Next message: Mike Kienenberger: "Re: Problems with DataContextDelegate"

    Hi all,

    I've two different classes with the following code:

    private static DataContext dataContext;
    private static DataContextDelegate dataContextDelegate;

    static
    {
                    
            dataContext = DataContext.createDataContext();
            dataContextDelegate = new DataContextDelegate() {
                    public void finishedMergeChanges ( DataObject object ) {
                            System.out.println("Class 1(or
    2):finishedMergeChanges");
                            dataContext.refetchObject(object.getObjectId());
                            // ...GUI synch code here...
                    }
                    public void finishedProcessDelete ( DataObject object ) {
                            ; // Nothing to do.
                    }
                    public boolean shouldMergeChanges ( DataObject object,
    DataRow snapshotInStore ) {
                            return true;
                    }
                    public boolean shouldProcessDelete ( DataObject object ) {
                            return true;
                    }
                    public GenericSelectQuery willPerformSelect ( DataContext
    context, GenericSelectQuery query ) {
                            return query;
                    }
            };
            
            dataContext.setDelegate(dataContextDelegate);

    }

    Inside these two classes I load the same DataObject from my DB (a Microsoft
    SQL Server).
    When I modyfy the loaded object and commit the changes from one DataContext
    I expect a message from the delegate of the other, but this doesn't occurs
    (and my GUI remains not synchronized...).

    Where is the problem?

    Thanks

    Claudio

    ------------------------------------
    Advanced Computer Systems S.p.A.
    Claudio Rosati
    Project Manager
    claudio.rosat..csys.it
    via Della Bufalotta 378
    00139 Roma, RM
    Italy
    tel: +39 06 8709 0516
    fax: +39 06 8720 1502
    ------------------------------------



    This archive was generated by hypermail 2.0.0 : Wed Jan 05 2005 - 11:51:17 EST