[JIRA] Created: (CAY-771) CayenneContext.rollbackChanges (client-side) is marking objects in other contexts as transient!

From: Lachlan Deck (JIRA) ("Lachlan)
Date: Fri Mar 23 2007 - 04:02:44 EDT

  • Next message: Lachlan Deck (JIRA): "[JIRA] Created: (CAY-772) Steps towards unifying CayenneContext and DataContext via ObjectContext interface and DataObjectUtils"

    CayenneContext.rollbackChanges (client-side) is marking objects in other contexts as transient!
    -----------------------------------------------------------------------------------------------

                     Key: CAY-771
                     URL: https://issues.apache.org/cayenne/browse/CAY-771
                 Project: Cayenne
              Issue Type: Bug
              Components: Cayenne Core Library
        Affects Versions: 3.0
             Environment: Mac OS X 10.4.9, Java 1.5, Cayenne 3.0-prerelease svn 515808
                Reporter: Lachlan Deck
             Assigned To: Andrus Adamchik

    The problem is: (this is 3 tier client-side)
    - having two edit screens open, each with their own editing context but editing the same type of object
    - use one edit screen and enter some data (particular data that sets a relationship value)
    - close the edit screen where you've adjusted the data and then attempt to repeat the steps in the other edit screen.
    - Exception thrown because the object you're trying to set the relationship on no longer has a context!

    -------------------------------------------
    --- logging and stack traces -----
    -------------------------------------------
    The context rolling back changes: (our subclass is simply calling super)
    18:32:51,179 [AWT-EventQueue-0] DEBUG ish.oncourse.cayenne.CayenneContext - rollbackChanges:ish.oncourse.cayenne.CayenneContex..89de8

    Here's a stack trace from setPersistenceState; in our PersistentObject subclass I'm just logging (before calling super) the object. Notice this particular object is in a different context - but it's being marked as transient :-/

    ---- Here's the relevant stack trace from setPersistenceState in the object that shouldn't be touched -----
    18:32:51,245 [AWT-EventQueue-0] DEBUG ish.oncourse.cayenne.glue.PersistentObject - setPersistenceState context null? false
    18:32:51,245 [AWT-EventQueue-0] DEBUG ish.oncourse.cayenne.glue.PersistentObject - <ish.oncourse.cayenne.CourseClas..3810822, id=<ObjectId:CourseClass, TEMP:0
    0001FB5B97E3E8F>, state=new, context=ish.oncourse.cayenne.CayenneContex..71a74> old state : new, new transient
    java.lang.Exception
            at ish.oncourse.cayenne.glue.PersistentObject.setPersistenceState(PersistentObject.java:287)
            at org.apache.cayenne.ObjectContextStateLog.graphReverted(ObjectContextStateLog.java:89)
            at org.apache.cayenne.CayenneContextGraphManager.graphReverted(CayenneContextGraphManager.java:154)
            at org.apache.cayenne.CayenneContextMergeHandler$3.run(CayenneContextMergeHandler.java:105)
            at org.apache.cayenne.CayenneContextMergeHandler.runWithEventsDisabled(CayenneContextMergeHandler.java:286)
            at org.apache.cayenne.CayenneContextMergeHandler.graphRolledback(CayenneContextMergeHandler.java:102)
            at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.apache.cayenne.util.Invocation.fire(Invocation.java:204)
            at org.apache.cayenne.event.EventManager$Dispatch.fire(EventManager.java:397)
            at org.apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:146)
            at org.apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:58)
            at org.apache.cayenne.event.EventManager.dispatchEvent(EventManager.java:336)
            at org.apache.cayenne.event.EventManager.postEvent(EventManager.java:307)
            at org.apache.cayenne.remote.ClientChannel.onSync(ClientChannel.java:215)
            at org.apache.cayenne.CayenneContext.rollbackChanges(CayenneContext.java:276)
            at ish.oncourse.cayenne.CayenneContext.rollbackChanges(CayenneContext.java:159)
            at ish.oncourse.controller.CayenneController.rollbackChanges(CayenneController.java:281)
            at ish.oncourse.controller.EditController.cancelEditRecord(EditController.java:610)
            at ish.oncourse.controller.EditController.windowClosing(EditController.java:455)
            at java.awt.AWTEventMulticaster.windowClosing(AWTEventMulticaster.java:291)
            at java.awt.AWTEventMulticaster.windowClosing(AWTEventMulticaster.java:291)
            at java.awt.Window.processWindowEvent(Window.java:1190)
            at javax.swing.JFrame.processWindowEvent(JFrame.java:267)
            at java.awt.Window.processEvent(Window.java:1148)
            at java.awt.Component.dispatchEventImpl(Component.java:4021)
            at java.awt.Container.dispatchEventImpl(Container.java:2068)
            at java.awt.Window.dispatchEventImpl(Window.java:1774)
            at java.awt.Component.dispatchEvent(Component.java:3869)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    18:32:51,345 [AWT-EventQueue-0] DEBUG ish.oncourse.cayenne.glue.PersistentObject - setPersistenceState context null? true

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Fri Mar 23 2007 - 04:03:43 EDT