Examples of ReadObjectQuery


Examples of org.eclipse.persistence.queries.ReadObjectQuery

        // for XMLObjectReferenceMappings we need a non-shared cache, so
        // try and get a Unit Of Work from the XMLContext
        AbstractSession readSession = xmlContext.getReadSession(referenceClass);

        ReadObjectQuery query = new ReadObjectQuery();
        query.setReferenceClass(referenceClass);
        query.setSession(readSession);

        XMLDescriptor descriptor = (XMLDescriptor) readSession.getDescriptor(referenceClass);
        if (descriptor == null) {
            throw XMLMarshalException.descriptorNotFoundInProject(referenceClass.getName());
        }
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

    /**
     * INTERNAL:
     */
    protected ReadObjectQuery getQuery() {
        if (m_query == null) {
            m_query = new ReadObjectQuery(m_parentClass);
           
            Expression selectionCriteria = null;
            Iterator keys = m_queryKeyFields.keySet().iterator();
            ExpressionBuilder builder = new ExpressionBuilder();
           
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

            primaryKeyValues = policy.createPkVectorFromKey(primaryKey, session);
        }
       
        // Get the read object query and apply the properties to it.
        // PERF: use descriptor defined query to avoid extra query creation.
        ReadObjectQuery query = descriptor.getQueryManager().getReadObjectQuery();
       
        if (query == null) {
            // The properties/query hints and setIsExecutionClone etc. is set
            // in the getReadObjectQuery.
            query = getReadObjectQuery(descriptor.getJavaClass(), primaryKeyValues, properties);
        } else {
            query.checkPrepare(session, null);
            query = (ReadObjectQuery)query.clone();
           
            // Apply the properties if there are some.
            QueryHintsHandler.apply(properties, query, session.getLoader());
           
            query.setIsExecutionClone(true);
            query.setSelectionKey(primaryKeyValues);
        }
       
        // Apply any EclipseLink defaults if they haven't been set through
        // the properties.
        if (properties == null || ! properties.containsKey(QueryHints.CACHE_USAGE)) {
            query.conformResultsInUnitOfWork();
        }
       
        return executeQuery(query, lockMode, (UnitOfWork) session);
    }
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

            if (! contains(entity, uow)) {
                throw new IllegalArgumentException(ExceptionLocalization.buildMessage("cant_refresh_not_managed_object", new Object[] { entity }));
            }

            // Get the read object query and apply the properties to it.       
            ReadObjectQuery query = getReadObjectQuery(entity, properties);
           
            // Apply any EclipseLink defaults if they haven't been set through
            // the properties.
            if (properties == null || ! properties.containsKey(QueryHints.REFRESH)) {
                query.refreshIdentityMapResult();
            }
           
            if (properties == null || ! properties.containsKey(QueryHints.REFRESH_CASCADE)) {
                query.cascadeByMapping();
            }
           
            Object refreshedEntity = executeQuery(query, lockMode, uow);
            if (refreshedEntity == null) {
                // bug5955326, ReadObjectQuery will now ensure the object is invalidated if refresh returns null.
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

    /**
     * Build a selection query for the primary key values.
     */
    protected ReadObjectQuery getReadObjectQuery(Class referenceClass, List primaryKeyValues, Map properties) {
        ReadObjectQuery query = getReadObjectQuery(properties);
        query.setReferenceClass(referenceClass);
        query.setSelectionKey(primaryKeyValues);
        return query;
    }
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

   
    /**
     * Build a selection query using the given properties.
     */
    protected ReadObjectQuery getReadObjectQuery(Map properties) {
        ReadObjectQuery query = new ReadObjectQuery();
       
        // Apply the properties if there are some.
        QueryHintsHandler.apply(properties, query, this.serverSession.getDatasourcePlatform().getConversionManager().getLoader());
        query.setIsExecutionClone(true);
        return query;
    }
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

   
    /**
     * Build a selection query for the given entity.
     */
    protected ReadObjectQuery getReadObjectQuery(Object entity, Map properties) {
        ReadObjectQuery query = getReadObjectQuery(properties);
        query.setSelectionObject(entity);
        return query;
    }
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

        try {
            verifyOpen();
           
            if (lockMode.name().contains(ObjectLevelReadQuery.PESSIMISTIC)) {
                // Get the read object query and apply the properties to it.       
                ReadObjectQuery query = getReadObjectQuery(entity, properties);
               
                // Apply any EclipseLink defaults if they haven't been set through
                // the properties.
                if (properties == null || ! properties.containsKey(QueryHints.REFRESH)) {
                    query.refreshIdentityMapResult();
                }
               
                if (properties == null || ! properties.containsKey(QueryHints.REFRESH_CASCADE)) {
                    query.cascadePrivateParts();
                }
               
                executeQuery(query, lockMode, getActivePersistenceContext(checkForTransaction(false)));
            } else {
                RepeatableWriteUnitOfWork context = getActivePersistenceContext(checkForTransaction(false));
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

        if(null == xmlRow.getDOM().getAttributes().getNamedItemNS(XMLConstants.SCHEMA_INSTANCE_URL, XMLConstants.SCHEMA_NIL_ATTRIBUTE)) {
            xmlRow.setUnmarshaller(xmlUnmarshaller);
            xmlRow.setDocPresPolicy(xmlContext.getDocumentPreservationPolicy(readSession));
            XMLObjectBuilder objectBuilder = (XMLObjectBuilder) descriptor.getObjectBuilder();

            ReadObjectQuery query = new ReadObjectQuery();
            query.setReferenceClass(referenceClass);
            query.setSession(readSession);
            object = objectBuilder.buildObject(query, xmlRow, null);

            // resolve mapping references
            xmlUnmarshaller.resolveReferences(readSession);
        }
View Full Code Here

Examples of org.eclipse.persistence.queries.ReadObjectQuery

            }

            // PROCESS TRANSFORMATION MAPPINGS
            List transformationMappings = treeObjectBuilder.getTransformationMappings();
            if (null != transformationMappings) {
                ReadObjectQuery query = new ReadObjectQuery();
                query.setSession(session);
                for (int x = 0, transformationMappingsSize = transformationMappings.size(); x < transformationMappingsSize; x++) {
                    AbstractTransformationMapping transformationMapping = (AbstractTransformationMapping)transformationMappings.get(x);
                    transformationMapping.readFromRowIntoObject(transformationRecord, null, currentObject, null, query, session, true);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.