Hollow objects

From: Fabricio Voznika (fabricio.voznik..artmouth.EDU)
Date: Wed Jul 23 2003 - 10:40:39 EDT

  • Next message: Andrus Adamchik: "Re: Hollow objects"

    Hi,

        I've gotta a question. I'm just starting with Cayenne, so it could
    all be non sense :-)
        Let's suppose I have a hollow object x. When I call x.getName(),
    this call will end up in the CayenneDataObject.readProperty(String)
    method bellow:

    CayenneDataObject:
        protected Object readProperty(String propName) {
            try {
                if (persistenceState == PersistenceState.HOLLOW) {
                    dataContext.refetchObject(objectId);
                }
            } catch (Exception ex) {
                logObj.info("Error refetching object, making transient.", ex);
                setPersistenceState(PersistenceState.TRANSIENT);
            }

            return readPropertyDirectly(propName);
        }

        The check for hollow is made and then refetchObject(ObjectId) is
    called, which seems right. The problem is that refetchObject returns a
    new DataObject and nothing is done to the current object, so
    readProperty will always return null for a hollow object. Did I miss
    anything?

        I found this trying to figure out what would happen if I set a
    property in a hollow object and then read a property. Will the property
    I set be overridden? Oh, I'm using Cayenne 1.0rc1.

    Thanks for your help,

    -- 
    Fabricio Voznika
    Senior Programmer/Analyst
    Administrative Computing
    Dartmouth College
    Phone: 603-646-2007
    



    This archive was generated by hypermail 2.0.0 : Wed Jul 23 2003 - 10:38:05 EDT