Package org.eclipse.persistence.queries

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


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

        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

        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

            }

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

        if (type == null) {
            throw new IllegalArgumentException("DynamicHelper.createQuery: Dynamic type not found: " + typeName);
        }

        return new ReadObjectQuery(type.getJavaClass());
    }
View Full Code Here

            if (descriptor.getCMPPolicy().getPKClass() != null && !descriptor.getCMPPolicy().getPKClass().isAssignableFrom(primaryKey.getClass())) {
                throw new IllegalArgumentException(ExceptionLocalization.buildMessage("invalid_pk_class", new Object[] { descriptor.getCMPPolicy().getPKClass(), primaryKey.getClass() }));
            }
            primaryKeyValues = descriptor.getCMPPolicy().createPkVectorFromKey(primaryKey, (AbstractSession)session);
        }
        ReadObjectQuery query = new ReadObjectQuery(descriptor.getJavaClass());
        query.setSelectionKey(primaryKeyValues);
        query.conformResultsInUnitOfWork();
        query.setIsExecutionClone(true);
        return session.executeQuery(query);
    }
View Full Code Here

            verifyOpen();
            UnitOfWork uow = getActivePersistenceContext(checkForTransaction(!isExtended()));
            if (!contains(entity, uow)) {
                throw new IllegalArgumentException(ExceptionLocalization.buildMessage("cant_refresh_not_managed_object", new Object[] { entity }));
            }
            ReadObjectQuery query = new ReadObjectQuery();
            query.setSelectionObject(entity);
            query.refreshIdentityMapResult();
            query.cascadeByMapping();
            query.setLockMode(ObjectBuildingQuery.NO_LOCK);
            query.setIsExecutionClone(true);
            Object refreshedEntity = null;
            refreshedEntity = uow.executeQuery(query);
            if (refreshedEntity == null) {
                // bug5955326, ReadObjectQuery will now ensure the object is invalidated if refresh returns null.
                throw new EntityNotFoundException(ExceptionLocalization.buildMessage("entity_no_longer_exists_in_db", new Object[] { entity }));
View Full Code Here

                    // value read query
                    databaseQueryToInitialize = new ValueReadQuery();
                }
                else {
                    // read object query for the class mapped to the type
                    databaseQueryToInitialize = new ReadObjectQuery(xrService.getTypeClass(type));
                }
            }
        }
        else {
            databaseQueryToInitialize = new DataModifyQuery();
View Full Code Here

     *
     * @see  {@link Operation}
     */
    @Override
    public Object invoke(XRServiceAdapter xrService, Invocation invocation) {
        ReadObjectQuery roq =
            (ReadObjectQuery)classDescriptor.getQueryManager().getQuery(PK_QUERYNAME);
        List queryArguments = roq.getArguments();
        int queryArgumentsSize = queryArguments.size();
        Vector executeArguments = new NonSynchronizedVector();
        for (int i = 0; i < queryArgumentsSize; i++) {
            String argName = (String)queryArguments.get(i);
            executeArguments.add(invocation.getParameter(argName));
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.queries.ReadObjectQuery

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.