/** * INTERNAL: * Get the container policy from the selection query for this mapping. This * method is overridden in DirectCollectionMapping since its selection * query is a DataReadQuery. */ protected ContainerPolicy getSelectionQueryContainerPolicy() { return ((ReadAllQuery) getSelectionQuery()).getContainerPolicy(); }
/** * INTERNAL: * replace the value holders in the specified result object(s) */ @Override public Map replaceValueHoldersIn(Object object, RemoteSessionController controller) { return controller.replaceValueHoldersInAll(object, getContainerPolicy()); }
/** * INTERNAL: * Get the container policy from the selection query for this mapping. This * method is overridden in DirectCollectionMapping since its selection * query is a DataReadQuery. */ protected ContainerPolicy getSelectionQueryContainerPolicy() { return ((ReadAllQuery) getSelectionQuery()).getContainerPolicy(); }
/** * INTERNAL: * Get the container policy from the selection query for this mapping. This * method is overridden in DirectCollectionMapping since its selection * query is a DataReadQuery. */ protected ContainerPolicy getSelectionQueryContainerPolicy() { return ((ReadAllQuery) getSelectionQuery()).getContainerPolicy(); }
/** * INTERNAL: * replace the value holders in the specified result object(s) */ @Override public Map replaceValueHoldersIn(Object object, RemoteSessionController controller) { return controller.replaceValueHoldersInAll(object, getContainerPolicy()); }
/** * INTERNAL: * replace the value holders in the specified result object(s) */ public Map replaceValueHoldersIn(Object object, RemoteSessionController controller) { return controller.replaceValueHoldersInAll(object, getContainerPolicy()); }
/** * INTERNAL: * Clone the query. */ public Object clone() { ReadAllQuery cloneQuery = (ReadAllQuery)super.clone(); // Don't use setters as that will trigger unprepare cloneQuery.containerPolicy = getContainerPolicy().clone(cloneQuery); return cloneQuery; }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ public void prepareForExecution() throws QueryException { super.prepareForExecution(); getContainerPolicy().prepareForExecution(); }
/** * INTERNAL: * <P> This method is called by the object builder when building an original. * It will cause the original to be cached in the query results if the query * is set to do so. */ public void cacheResult(Object unwrappedOriginal) { Collection container = (Collection)getTemporaryCachedQueryResults(); if (container == null) { container = (Collection)getContainerPolicy().containerInstance(); setTemporaryCachedQueryResults(container); } getContainerPolicy().addInto(unwrappedOriginal, container, getSession()); }
/** * INTERNAL: * <P> This method is called by the object builder when building an original. * It will cause the original to be cached in the query results if the query * is set to do so. */ @Override public void cacheResult(Object unwrappedOriginal) { Collection container = (Collection)getTemporaryCachedQueryResults(); if (container == null) { container = (Collection)getContainerPolicy().containerInstance(); setTemporaryCachedQueryResults(container); } getContainerPolicy().addInto(unwrappedOriginal, container, getSession()); }
/** * INTERNAL: * <P> This method is called by the object builder when building an original. * It will cause the original to be cached in the query results if the query * is set to do so. */ @Override public void cacheResult(Object unwrappedOriginal) { Collection container = (Collection)getTemporaryCachedQueryResults(); if (container == null) { container = (Collection)getContainerPolicy().containerInstance(); setTemporaryCachedQueryResults(container); } getContainerPolicy().addInto(unwrappedOriginal, container, getSession()); }
/** * INTERNAL: * Extract the correct query result from the transporter. */ @Override public Object extractRemoteResult(Transporter transporter) { return ((DistributedSession)getSession()).getObjectsCorrespondingToAll(transporter.getObject(), transporter.getObjectDescriptors(), new IdentityHashMap(), this, getContainerPolicy()); }
/** * INTERNAL: * Select all objects for a concrete descriptor. */ @Override protected Object selectAllObjects(ReadAllQuery query) { if (this.descriptor.isAbstract()) { return query.getContainerPolicy().containerInstance(); } return super.selectAllObjects(query); }
/** * INTERNAL: * Extract the correct query result from the transporter. */ @Override public Object extractRemoteResult(Transporter transporter) { return ((DistributedSession)getSession()).getObjectsCorrespondingToAll(transporter.getObject(), transporter.getObjectDescriptors(), new IdentityHashMap(), this, getContainerPolicy()); }
/** * INTERNAL: * Select all objects for a concrete descriptor. */ @Override protected Object selectAllObjects(ReadAllQuery query) { if (this.descriptor.isAbstract()) { return query.getContainerPolicy().containerInstance(); } return super.selectAllObjects(query); }
/** * INTERNAL: * Extract the correct query result from the transporter. */ public Object extractRemoteResult(Transporter transporter) { return ((RemoteSession)getSession()).getObjectsCorrespondingToAll(transporter.getObject(), transporter.getObjectDescriptors(), new IdentityHashMap(), this, getContainerPolicy()); }
/** * INTERNAL: * Execute the query through remote session. */ public Object remoteExecute() { if (getContainerPolicy().overridesRead()) { return getContainerPolicy().remoteExecute(); } Object cacheHit = checkEarlyReturn(getSession(), getTranslationRow()); if (cacheHit != null) { return cacheHit; } return super.remoteExecute(); }
/** * INTERNAL: * Return true if the query uses default properties. * This is used to determine if this query is cacheable. * i.e. does not use any properties that may conflict with another query * with the same JPQL or selection criteria. */ public boolean isDefaultPropertiesQuery() { return super.isDefaultPropertiesQuery() && (!hasBatchReadAttributes()) && (!hasHierarchicalExpressions()) && (!getContainerPolicy().isCursorPolicy()); }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (query.isReadAllQuery()) { if (!((ReadAllQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((ReadAllQuery) query).useCursoredStream(); } ((CursoredStreamPolicy)((ReadAllQuery) query).getContainerPolicy()).setInitialReadSize(QueryHintsHandler.parseIntegerHint(valueToApply, QueryHints.CURSOR_INITIAL_SIZE)); } else if (query.isDataReadQuery()) { if (!((DataReadQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((DataReadQuery) query).useCursoredStream(); } ((CursoredStreamPolicy)((DataReadQuery) query).getContainerPolicy()).setInitialReadSize(QueryHintsHandler.parseIntegerHint(valueToApply, QueryHints.CURSOR_INITIAL_SIZE)); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
/** * INTERNAL: * Set the properties needed to be cascaded into the custom query. */ protected void prepareCustomQuery(DatabaseQuery customQuery) { ReadAllQuery customReadQuery = (ReadAllQuery)customQuery; customReadQuery.setContainerPolicy(getContainerPolicy()); customReadQuery.setCascadePolicy(getCascadePolicy()); customReadQuery.setShouldRefreshIdentityMapResult(shouldRefreshIdentityMapResult()); customReadQuery.setShouldMaintainCache(shouldMaintainCache()); customReadQuery.setShouldUseWrapperPolicy(shouldUseWrapperPolicy()); }