if (!m_data.hasProperty(propertyName)) { throw new PersistenceException( "Unable to lazy load property: " + propertyName ); }
    public Object get(String propertyName) throws PersistenceException {        validate();        Property prop = checkProperty(propertyName);        // We want to return the cached value, if available if        // 1. the value is a standard scalar attribute (not a RoleReference)        // 2. the value is a RoleReference with Multiplicity upper bound        //    greater than 1 AND the cached value is null        // 3. the value is a RoleReference with Multiplicity upper bound        //    of 1 and the property has NOT been modified.  We reretrieve        //    the unmodified value because it is possible that the other        //    end of the association changed//        if (m_data.hasProperty(propertyName) && //            !(prop.isRole() && //              ((prop.isCollection() && m_data.get(propertyName) == null) ||//               (!prop.isCollection() &&//                !m_data.isPropertyModified(propertyName))))) {        if (m_data.hasProperty(propertyName)) {            return m_data.get(propertyName);        }        if (prop.isRole()) {            if (!prop.isCollection()) {                if (isNew()) {                    return null;                }                // We need to do this in case the role is being refetched.                m_data.clearProperty(propertyName);                if (!doRoleRetrieve(propertyName, (DataContainer)null)) {                    m_data.initProperty(propertyName, null);                }                return m_data.get(propertyName);            } else {                Event event = prop.getEvent(Property.RETRIEVE);                if (event == null) {                    throw new PersistenceException(                        "No retrieve event defined for " +                        "property '" + prop.getName() +                        "' of object type '" + m_type.getQualifiedName() +                        "' " + m_type.toString()                        );                }                Operation op = (Operation) event.getOperations().next();                DataAssociationImpl assn =                    new DataAssociationImpl(this, propertyName, op);                m_data.initProperty(propertyName, assn);                return assn;            }        } else {            if (isNew()) {                return null;            }            // Load the attribute on demand.            // First try just retrieving the attribute            if (! doRetrieve(propertyName) ) {                // doRettrieve(Attribute) failed.                // We now try to do a full retrieve of the data object if                 // either of the following is true:                //    - a full retrieve was never executed.  This could be the                //      case if this data object was new and then saved.                //      In this case, m_retrieveType will be null.                // OR                //    - this data object was retrieved as one type, then                //      specialized to a subtype.                // In either case, m_retreivedType!=m_type                if (m_retrievedType != m_type) {                    // Do the full retrieve.                    if (! doRetrieve(getOID()) ) {                        // full retrieve failed                        // I removed the "no retrieve attr event defined"                        // exception from StaticEventBuilder.doRetrieve(attr)                        // For now, we throw the exception here.                        // TO DO: talk to Rafi about how he really wants                        // to handle this.                        throw new PersistenceException(                                  "Unable to retrieve attribute " +                                   propertyName +                                  " of object type " + m_type.getName() +                                  " because there is no retrieve attribute " +                                  " event handler defined for it and " +                                  " the retrieve object event returned no " +                                  " data."                                  );                    }                }            }            // If we get here, then either doRetrieve(Attribute) or             // doRetrieve(OID) succeeded (meaning that some sqlblock was             // executed).            return m_data.get(propertyName);        }    }