Re[2]: Child context for Web App

From: Razumovsky Andrey (hmai..otmail.ru)
Date: Sat Mar 22 2008 - 01:18:38 EDT

  • Next message: Pierre Gilquin: "Re: Re[2]: Child context for Web App"

    Hi Pierre,

    I haven't actually ever used the 'localObject' method. I mean you can work with nested context the same way as with parent (global) one, i.e:

    DataContext context = DataContext.createDataContext();

    DataContext nested = context.createChildDataContext();
    Dicrow d = (Dicrow)nested.newObject(Dicrow.class);
    d.setDicrowname("ABC");
                    
    //context.commitChanges(); //does nothing since child context isn't commited
    nested.commitChanges(); //creates new record in DB

    alternalively:
    nested.commitChangesToParent();
    context.commitChanges();

    Works fine for me, nested contexts won't work through ROP though, but it seems that's not your case.
    If this doesn't help, please describe your application in more detail.

    Andrey

    ��, 22.03.2008 10:59:27 you wrote:
    >
    PG>
    PG> Thanks Andrey,
    PG>
    PG>
    PG>
    PG> I am using what you propose for getting child context at session level
    PG> chidContext= globalContext.createChildDataContext();. But I dont understand your sentence :
    PG> >> it collapses to just calling one method.
    PG>
    PG> Do you mean using localObject to get object in globalContext ?
    PG>
    PG> objectInGlobalContext = (XXX) globalContext.localObject(myObjectInLocalContext.getObjectId(),myObjectInLocalContext);
    PG>
    PG>
    PG> Thanks again for your help
    PG>
    PG>
    PG>
    PG> Pierre
    PG>



    This archive was generated by hypermail 2.0.0 : Sat Mar 22 2008 - 05:39:55 EDT