[JIRA] Created: (CAY-663) localObject and new objects

From: Marcin Skladaniec (JIRA) ("Marcin)
Date: Fri Sep 22 2006 - 09:16:49 EDT

  • Next message: Andrus Adamchik: "Re: Any problems distributing Eclipse buttons?"

    localObject and new objects
    ---------------------------

             Key: CAY-663
             URL: http://issues.apache.org/cayenne/browse/CAY-663
         Project: Cayenne
            Type: Bug

      Components: Cayenne Core Library
        Versions: 1.2 [STABLE], 3.0
     Environment: any
        Reporter: Marcin Skladaniec

    This test:

                            CayenneContext context2 = new CayenneContext(channel, true, true);
                            CRoom localRoom = (CRoom)context2.newObject(CRoom.class);
                            CayenneContext context1 = new CayenneContext(channel, true, true);
                            
                            CRoom room = (CRoom)context1.newObject(CRoom.class);
                            context1.commitChanges();
                            
                            logger.warn("before :");
                            logger.warn("\t room " +room);
                            logger.warn("\t localRoom " +localRoom);
                            localRoom = (CRoom) context2.localObject(room.getObjectId(), room);
                            logger.warn("after :");
                            logger.warn("\t room " +room);
                            logger.warn("\t localRoom " +localRoom);

    gives unexpected results :

    before :
            room <cayenne3t.example.hr.CRoo..254986, id=<ObjectId:Room, id=461>, state=committed, context=org.objectstyle.cayenne.CayenneContext@c10de0>
            localRoom <cayenne3t.example.hr.CRoo..0754076, id=<ObjectId:Room, TEMP:000000A541400003>, state=new, context=org.objectstyle.cayenne.CayenneContext@8c5e67>
    after :
            room <cayenne3t.example.hr.CRoo..254986, id=<ObjectId:Room, id=461>, state=committed, context=org.objectstyle.cayenne.CayenneContext@c10de0>
            localRoom <cayenne3t.example.hr.CRoo..816245, id=<ObjectId:Room, id=461>, state=new, context=org.objectstyle.cayenne.CayenneContext@8c5e67>

    as you can see, after localObject the PersistentState.COMMITED object gets PersistentState.NEW state! (while still keeping the right permanent PK)

    whether prototype in localObject is set or not, it does not matter.

    -- 
    This message is automatically generated by JIRA.
    -
    If you think it was sent incorrectly contact one of the administrators:
       http://issues.apache.org/cayenne/secure/Administrators.jspa
    -
    For more information on JIRA, see:
       http://www.atlassian.com/software/jira
    



    This archive was generated by hypermail 2.0.0 : Fri Sep 22 2006 - 09:20:45 EDT