Package com.sun.jdo.spi.persistence.support.sqlstore.sql

Examples of com.sun.jdo.spi.persistence.support.sqlstore.sql.RetrieveDescImpl


     * @param store The store manager.
     * @return A RetrieveDescriptor selecting a pc instance by pk-fields.
     * @see #getRetrieveDescForFKQuery
     */
    public RetrieveDesc getRetrieveDescForPKQuery(FieldDesc additionalField, PersistenceStore store) {
        RetrieveDescImpl rd = null;
        String cacheKey = generateRDCacheKey(additionalField);

        synchronized (retrieveDescCache) {
            // Cache lookup.
            rd = (RetrieveDescImpl) retrieveDescCache.get(cacheKey);
            // Generate a new RD if there isn't one be found in the cache.
            if (rd == null) {
                rd = (RetrieveDescImpl) store.getRetrieveDesc(pcClass);
                if (additionalField != null) {
                    RetrieveDesc frd = null;
                    String name = additionalField.getName();
                    // If the additionalField is not null, we will retrieve
                    // the field indicated by it along with the query.
                    if (additionalField instanceof ForeignFieldDesc) {
                        Class additionalClass = ((ForeignFieldDesc) additionalField).
                                foreignConfig.getPersistenceCapableClass();

                        frd = store.getRetrieveDesc(additionalClass);
                    }

                    rd.addPrefetchedField(name, frd);
                }

                addPKConstraints(rd);
                // Cache fillup.
                retrieveDescCache.put(cacheKey, rd);
View Full Code Here


     * @return A RetrieveDescriptor selecting pc instance(s) corresponding to
     * the foreign field
     * @see #getRetrieveDescForPKQuery
     */
    public RetrieveDesc getRetrieveDescForFKQuery(ForeignFieldDesc foreignField, PersistenceStore store) {
        RetrieveDescImpl rd = null;
        String cacheKey = generateRDCacheKey(foreignField);

        synchronized (foreignRetrieveDescCache) {
            // Cache lookup.
            rd = (RetrieveDescImpl) foreignRetrieveDescCache.get(cacheKey);
View Full Code Here

        assert hasVersionConsistency();

        synchronized(retrieveDescForVerificationSynchObj) {
            if (retrieveDescForVerification == null) {
                RetrieveDescImpl rd = (RetrieveDescImpl) store.getRetrieveDesc(pcClass);

                int index = addPKConstraints(rd);
                rd.addParameterConstraints(versionFields, index);
                rd.setOption(RetrieveDescImpl.OPT_VERIFY);

                retrieveDescForVerification = rd;
            }
        }
        return retrieveDescForVerification;
View Full Code Here

     *
     * @param classType Type of the persistence capable class to be queried.
     * @return A new retrieve descriptor for anexternal (user) query.
     */
    public RetrieveDesc getRetrieveDesc(Class classType) {
        return new RetrieveDescImpl(classType, (ClassDesc) getPersistenceConfig(classType));
    }
View Full Code Here

                    "core.generic.notinstanceof", // NOI18N
                    action.getClass().getName(),
                    "RetrieveDescImpl")); // NOI18N
        }

        RetrieveDescImpl retrieveAction = ((RetrieveDescImpl) action);
        ClassDesc config = retrieveAction.getConfig();
        Concurrency concurrency = config.getConcurrency(pm.isOptimisticTransaction());
        SelectQueryPlan plan = retrieveAction.buildQueryPlan(this, concurrency);
        ArrayList statements = plan.getStatements();
        Object result = null;

        SelectStatement s = (SelectStatement) statements.get(0);
        result = executeQuery(pm, s, concurrency, parameters);
View Full Code Here

        independentGroupMask = new BitSet();
        this.concurrency = concurrency;
        //excludeSubclasses = true;

        if (desc instanceof RetrieveDescImpl) {
            RetrieveDescImpl retrieveDesc = (RetrieveDescImpl) desc;
            retrieveDesc.setPlan(this);

            // Get the information from the retrieve descriptor.
            constraint = retrieveDesc.getConstraint();
            options = retrieveDesc.getOptions();
            fieldIterator = retrieveDesc.getFields();
            aggregateResultType = retrieveDesc.getAggregateResultType();
        } else {
            throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
                "core.generic.notinstanceof", desc.getClass().getName(), "RetrieveDescImpl")); // NOI18N
        }
    }
View Full Code Here

                        if ( ((options & RetrieveDescImpl.OPT_PROJECTION) > 0 || MULTILEVEL_PREFETCH) &&
                              (options & RetrieveDescImpl.OPT_ADD_KEYS_ONLY) == 0 &&
                              (options & RetrieveDescImpl.OPT_DISABLE_RELATIONSHIP_PREFETCH) == 0 ) {
                            // Add current field to foreignFields as ConstraintFieldName
                            ForeignFieldDesc ff = (ForeignFieldDesc) f;
                            RetrieveDescImpl desc = (RetrieveDescImpl)
                                    store.getRetrieveDesc(ff.foreignConfig.getPersistenceCapableClass());
                            foreignFields.add(new ConstraintFieldName(ff.getName(), desc, true));
                        }
                    }
                }
View Full Code Here

                    if (fieldNode.desc == null) {
                        thePlan = this;
                    } else {
                        // If the field belongs to a different RetrieveDesc, we need
                        // to use the query plan associated with that RetrieveDesc.
                        RetrieveDescImpl rd = (RetrieveDescImpl) fieldNode.desc;
                        thePlan = newForeignConstraintPlan(rd, fieldNode.name);
                    }

                    fieldNode.originalPlan = thePlan;
View Full Code Here

     * or {@link ActionDesc#OP_EXISTS}.
     */
    private void addCorrelatedExistsQuery(ForeignFieldDesc ff, int operation) {

        Class classType = (ff.cardinalityUPB > 1) ? ff.getComponentType() : ff.getType();
        RetrieveDescImpl rd = (RetrieveDescImpl) store.getRetrieveDesc(classType);

        SelectQueryPlan subqueryPlan = new CorrelatedExistSelectPlan(rd, store, ff, this);
        subqueryPlan.build();

        // Make the tables involved in the subquery known to the parent query.
View Full Code Here

     * {@link RetrieveDesc#addConstraint(String, RetrieveDesc)}.
     *
     * @param node Join constraint.
     */
    private void processForeignFieldConstraint(ConstraintForeignFieldName node) {
        RetrieveDescImpl rd = (RetrieveDescImpl) node.desc;

        if (rd == null) {
            throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
                    "sqlstore.constraint.noretrievedesc", // NOI18N
                    node.name, config.getPersistenceCapableClass().getName()));
View Full Code Here

TOP

Related Classes of com.sun.jdo.spi.persistence.support.sqlstore.sql.RetrieveDescImpl

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.