Using dataobject from a DataContext in other DataContext

From: Leonardo R. Nunes (leonard..umersoft.com)
Date: Fri Nov 21 2003 - 15:21:23 EST

  • Next message: Andrus Adamchik: "Re: Using dataobject from a DataContext in other DataContext"

    Is that not allowed ? I'm getting my dataObject from one DataContex and
    trying to delete my dataObject in other DataContext.
    In the example bellow the delete doesn't work.
     
     
                            DataContext dataContext1 =
    DataContext.createDataContext();
                            DataContext dataContext2 =
    DataContext.createDataContext();
     
                            SelectQuery query = new
    SelectQuery(MyDataObjectClass.class);
     
                            List all1 = dataContext1.performQuery(query);
                            List all2 = dataContext2.performQuery(query);
     
                            System.err.println("Query1: " + all1 + " Hash:"
    + all1.hashCode());
                            System.err.println("Query2: " + all2 + " Hash:"
    + all2.hashCode());
     
                            for (int i = 0; i < all2.size(); i++) {
                                       MyDataObjectClass myObject =
    (MyDataObjectClass) all2.get(i);
                                       dataContext1.deleteObject(myObject);
                                       dataContext1.commitChanges();
                            }
                            System.err.println("OK");
     
                            DataContext dataContext3 =
    DataContext.createDataContext();
                            List all3 = dataContext3.performQuery(query);
                            System.err.println("Query3: " + all3 + " Hash:"
    + all3.hashCode());
     
    ********************
    Leonardo R. Nunes
    Sumersoft Tecnologia
    http://www.sumersoft.com
     



    This archive was generated by hypermail 2.0.0 : Fri Nov 21 2003 - 14:18:25 EST