You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Ari Maniatis (JIRA)" <ji...@apache.org> on 2006/09/12 15:39:49 UTC

[JIRA] Created: (CAY-653) overriding setPersistentState() in unreliable in three tier environment with CayenneContext

overriding setPersistentState() in unreliable in three tier environment with CayenneContext
-------------------------------------------------------------------------------------------

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

  Components: Cayenne Core Library  
    Versions: 1.2 [STABLE]    
    Reporter: Ari Maniatis


After looking at the source for CayenneContext.newObject (and non-public CayenneContext.createNewObject) it seems that overriding setPersistentState (as suggested: http://cwiki.apache.org/confluence/display/CAY/Setting+Initial+Values) is a bad idea, esp for new objects. i.e., at the point of being NEW the object's ValueHolder vars have not yet been initiated, it doesn't yet have a handle on the context, it's global id has not been set, and it's not been registered with the graph manager etc. Simply put, bad stuff happens when messing with the objects ValueHolder vars prior to all of this.

Perhaps a delegate such as EOF's awakeFromInsertion() would be ideal. This would hook in as the very last thing CayenneContext.createNewObject() does before returning and would avoid users having to subclass the context.

-- 
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