You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Marcin Skladaniec (JIRA)" <ca...@incubator.apache.org> on 2006/09/22 15:16:49 UTC

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

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.CRoom@8254986, id=<ObjectId:Room, id=461>, state=committed, context=org.objectstyle.cayenne.CayenneContext@c10de0>
	localRoom <cayenne3t.example.hr.CRoom@10754076, id=<ObjectId:Room, TEMP:000000A541400003>, state=new, context=org.objectstyle.cayenne.CayenneContext@8c5e67>
after :
	room <cayenne3t.example.hr.CRoom@8254986, id=<ObjectId:Room, id=461>, state=committed, context=org.objectstyle.cayenne.CayenneContext@c10de0>
	localRoom <cayenne3t.example.hr.CRoom@2816245, 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