Package org.jpox.store.mapped.mapping

Examples of org.jpox.store.mapped.mapping.OIDMapping


     * @param refTable Table used as a reference (if any)
     * @param cmd The MetaData for the class
     */
    void addDatastoreId(ColumnMetaDataContainer columnContainer, DatastoreClass refTable, AbstractClassMetaData cmd)
    {
        datastoreIDMapping = new OIDMapping();
        datastoreIDMapping.initialize(dba, cmd.getFullClassName());

        // Create a ColumnMetaData in the container if none is defined
        ColumnMetaData colmd = null;
        if (columnContainer == null)
View Full Code Here


        {
            obj = getObjectByAID(om, (ResultSet)rs, fieldNumbers, cmd, pcClassForObject, requiresInheritanceCheck);
        }
        else if (cmd.getIdentityType() == IdentityType.DATASTORE)
        {
            JavaTypeMapping mapping = new OIDMapping();
            mapping.initialize(table.getStoreManager().getDatastoreAdapter(), pcClassForObject.getName());
            mapping.addDataStoreMapping(table.getDataStoreObjectIdMapping().getDataStoreMapping(0));
            Object id = mapping.getObject(om, rs, datastoreIdentityExpressionIndex);
            if (fieldNumbers == null)
            {
                obj = om.findObject(id, false, requiresInheritanceCheck, null);
            }
            else
            {
              if (requiresInheritanceCheck)
              {
                    obj = getObjectById(om, (ResultSet)rs, fieldNumbers, cmd, id, null);
              }
              else
              {
                obj = getObjectById(om, (ResultSet)rs, fieldNumbers, cmd, id, pcClassForObject);
              }
            }
        }
        else if (cmd.getIdentityType() == IdentityType.NONDURABLE)
        {
            Object id = om.newObjectId(className, null);
            if (fieldNumbers == null)
            {
                obj = om.findObject(id, false, requiresInheritanceCheck, null);
            }
            else
            {
                obj = getObjectById(om, (ResultSet)rs, fieldNumbers, cmd, id, pcClassForObject);
            }
        }

        // Set the version of the object where possible
        int versionFieldNumber = -1;
        VersionMetaData vermd = table.getVersionMetaData();
        if (vermd != null && vermd.getFieldName() != null)
        {
            // Version stored in a normal field
            // TODO Should only do this if the version was just retrieved
            versionFieldNumber = acmd.getMetaDataForMember(vermd.getFieldName()).getAbsoluteFieldNumber();
            StateManager objSM = om.findStateManager(obj);
            Object verFieldValue = objSM.provideField(versionFieldNumber);
            if (verFieldValue != null)
            {
                objSM.setVersion(verFieldValue);
            }
        }

        if (versionIndex != null)
        {
            // Surrogate version column returned by query
            JavaTypeMapping mapping = table.getVersionMapping(true);
            Object version = mapping.getObject(om, rs, versionIndex);
            StateManager objSM = om.findStateManager(obj);
            objSM.setVersion(version);
        }

        return obj;
View Full Code Here

TOP

Related Classes of org.jpox.store.mapped.mapping.OIDMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.