Re: Selective commit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jan 09 2008 - 08:06:27 EST

  • Next message: Andrus Adamchik: "Re: Commit Exception Error"

    Great!

    Also good that we found the deadlock condition. Usually nested
    contexts are used in a (semi)single-threaded environment, e.g. to
    provide local "savepoints" for nested Swing dialogs, or in a "context-
    per-web-request" situation with the same goal to avoid committing the
    main context between multiple requests... So this got overlooked. Now
    I was able to easily reproduce the condition:

    https://issues.apache.org/cayenne/browse/CAY-957

    Will work on fixing it, but also good to know that there's not much
    urgency in that.

    Thanks,
    Andrus

    On Jan 9, 2008, at 10:51 AM, Álvaro Martínez wrote:

    >
    > Using brand new data contexts solved the problem! I just replaced
    > this function:
    >
    > public DataContext getNewContext() {
    > DataContext newContext = context.createChildDataContext();
    > newContext.setTransactionEventsEnabled(true);
    > newContext.setValidatingObjectsOnCommit(true);
    > return newContext;
    > }
    >
    > With this one:
    >
    > public DataContext getNewContext() {
    > return DataContext.createDataContext(true);
    > }
    >
    > And everything is ok now. I didn't touch any other piece of code.
    >
    > Thank you very much!
    >
    >
    >
    > Andrus Adamchik escribió:
    >> BTW, while I am investigating the bug with nested contexts ... do
    >> you have to use them at all? Can you just use multiple peer
    >> DataContexts instead?
    >>
    >> Andrus
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Jan 09 2008 - 08:07:01 EST