/** * INTERNAL: * Prepare the receiver for execution in a session. */ protected void prePrepare() throws QueryException { super.prePrepare(); //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && getSession().getProject().hasProxyIndirection()) { setSelectionObject(ProxyIndirectionPolicy.getValueFromProxy(getSelectionObject())); } }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ protected void prePrepare() throws QueryException { super.prePrepare(); //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && getSession().getProject().hasProxyIndirection()) { setSelectionObject(ProxyIndirectionPolicy.getValueFromProxy(getSelectionObject())); } }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ protected void prePrepare() throws QueryException { super.prePrepare(); //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && getSession().getProject().hasProxyIndirection()) { setSelectionObject(ProxyIndirectionPolicy.getValueFromProxy(getSelectionObject())); } }
protected Object remoteExecute() { // Do a cache lookup. checkDescriptor(session); // As the selection object is transient, compute the key. if (getSelectionObject() != null) { // Must be checked separately as the expression and row is not yet set. setSelectionKey(getDescriptor().getObjectBuilder().extractPrimaryKeyFromObject(getSelectionObject(), session)); } Object cacheHit = checkEarlyReturn(getSession(), getTranslationRow()); if ((cacheHit != null) || shouldCheckCacheOnly()) { return cacheHit; } return super.remoteExecute(); }
protected Object remoteExecute() { // Do a cache lookup. checkDescriptor(session); // As the selection object is transient, compute the key. if (getSelectionObject() != null) { // Must be checked separately as the expression and row is not yet set. setSelectionId(getDescriptor().getObjectBuilder().extractPrimaryKeyFromObject(getSelectionObject(), session)); } Object cacheHit = checkEarlyReturn(getSession(), getTranslationRow()); if ((cacheHit != null) || shouldCheckCacheOnly()) { if (cacheHit == InvalidObject.instance) { return null; } return cacheHit; } return super.remoteExecute(); }
protected Object remoteExecute() { // Do a cache lookup. checkDescriptor(session); // As the selection object is transient, compute the key. if (getSelectionObject() != null) { // Must be checked separately as the expression and row is not yet set. setSelectionId(getDescriptor().getObjectBuilder().extractPrimaryKeyFromObject(getSelectionObject(), session)); } Object cacheHit = checkEarlyReturn(getSession(), getTranslationRow()); if ((cacheHit != null) || shouldCheckCacheOnly()) { if (cacheHit == InvalidObject.instance) { return null; } return cacheHit; } return super.remoteExecute(); }
/** * INTERNAL: * Ensure that the descriptor has been set. */ public void checkDescriptor(AbstractSession session) throws QueryException { if (this.descriptor == null) { if (getReferenceClass() == null) { throw QueryException.referenceClassMissing(this); } ClassDescriptor referenceDescriptor; //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && session.getProject().hasProxyIndirection()) { referenceDescriptor = session.getDescriptor(getSelectionObject()); } else { referenceDescriptor = session.getDescriptor(getReferenceClass()); } if (referenceDescriptor == null) { throw QueryException.descriptorIsMissing(getReferenceClass(), this); } setDescriptor(referenceDescriptor); } }
/** * INTERNAL: * Ensure that the descriptor has been set. */ public void checkDescriptor(AbstractSession session) throws QueryException { if (this.descriptor == null) { if (getReferenceClass() == null) { throw QueryException.referenceClassMissing(this); } ClassDescriptor referenceDescriptor; //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && session.getProject().hasProxyIndirection()) { referenceDescriptor = session.getDescriptor(getSelectionObject()); } else { referenceDescriptor = session.getDescriptor(getReferenceClass()); } if (referenceDescriptor == null) { throw QueryException.descriptorIsMissing(getReferenceClass(), this); } setDescriptor(referenceDescriptor); } }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ public void prepareForExecution() throws QueryException { super.prepareForExecution(); // For bug 2989998 the translation row now sometimes set earlier in prepare. if (shouldPrepare()) { if (getSelectionKey() != null) { // Row must come from the key. setTranslationRow(this.descriptor.getObjectBuilder().buildRowFromPrimaryKeyValues(getSelectionKey(), getSession())); } else if (getSelectionObject() != null) { // The expression is set in the prepare as params. setTranslationRow(this.descriptor.getObjectBuilder().buildRowForTranslation(getSelectionObject(), getSession())); } } }
/** * INTERNAL: * Ensure that the descriptor has been set. */ public void checkDescriptor(AbstractSession session) throws QueryException { if (this.descriptor == null) { if (getReferenceClass() == null) { throw QueryException.referenceClassMissing(this); } ClassDescriptor referenceDescriptor; //Bug#3947714 In case getSelectionObject() is proxy if (getSelectionObject() != null && session.getProject().hasProxyIndirection()) { referenceDescriptor = session.getDescriptor(getSelectionObject()); } else { referenceDescriptor = session.getDescriptor(getReferenceClass()); } if (referenceDescriptor == null) { throw QueryException.descriptorIsMissing(getReferenceClass(), this); } setDescriptor(referenceDescriptor); } }
} else if (getSelectionObject() != null) { session.getParentIdentityMapSession(this, true, true).getIdentityMapAccessor().invalidateObject(getSelectionObject());
if (shouldLoadResultIntoSelectionObject()) { ObjectBuilder builder = this.descriptor.getObjectBuilder(); builder.copyInto(cachedObject, getSelectionObject()); session.getIdentityMapAccessorInstance().putInIdentityMap(getSelectionObject()); cachedObject = getSelectionObject();
/** * INTERNAL: * Set the properties needed to be cascaded into the custom query inlucding the translation row. */ protected void prepareCustomQuery(DatabaseQuery customQuery) { ReadObjectQuery customReadQuery = (ReadObjectQuery)customQuery; customReadQuery.setShouldRefreshIdentityMapResult(shouldRefreshIdentityMapResult()); customReadQuery.setCascadePolicy(getCascadePolicy()); customReadQuery.setShouldMaintainCache(shouldMaintainCache()); customReadQuery.setShouldUseWrapperPolicy(shouldUseWrapperPolicy()); // CR... was missing some values, execution could cause infinite loop. customReadQuery.setQueryId(getQueryId()); customReadQuery.setExecutionTime(getExecutionTime()); customReadQuery.setShouldLoadResultIntoSelectionObject(shouldLoadResultIntoSelectionObject()); AbstractRecord primaryKeyRow; if (getSelectionObject() != null) { // CR#... Must also set the selection object as may be loading into the object (refresh) customReadQuery.setSelectionObject(getSelectionObject()); // The translation/primary key row will be set in prepareForExecution. } else if (getSelectionKey() != null) { customReadQuery.setSelectionKey(getSelectionKey()); } else { // The primary key row must be used. primaryKeyRow = customQuery.getDescriptor().getObjectBuilder().extractPrimaryKeyRowFromExpression(getSelectionCriteria(), customQuery.getTranslationRow(), customReadQuery.getSession()); customReadQuery.setTranslationRow(primaryKeyRow); } }
if (shouldLoadResultIntoSelectionObject()) { ObjectBuilder builder = this.descriptor.getObjectBuilder(); builder.copyInto(cachedObject, getSelectionObject()); session.getIdentityMapAccessorInstance().putInIdentityMap(getSelectionObject()); cachedObject = getSelectionObject();
if (shouldLoadResultIntoSelectionObject()) { ObjectBuilder builder = this.descriptor.getObjectBuilder(); builder.copyInto(cachedObject, getSelectionObject()); session.getIdentityMapAccessorInstance().putInIdentityMap(getSelectionObject()); cachedObject = getSelectionObject();
if ((getSelectionCriteria() != null) && (getSelectionKey() == null) && (getSelectionObject() == null)) { ExpressionBuilder builder = getSelectionCriteria().getBuilder(); builder.setSession(unitOfWork.getRootSession(null));
if ((getSelectionKey() != null) || (getSelectionObject() != null)) { setTranslationRow(getDescriptor().getObjectBuilder().buildRowForTranslation(getSelectionObject(), getSession()));
if ((getSelectionKey() != null) || (getSelectionObject() != null)) {// Must be primary key. setIsCustomQueryUsed(true); } else {
if (domainObject == null || shouldStoreBypassCache) { if (query.isReadObjectQuery() && ((ReadObjectQuery)query).shouldLoadResultIntoSelectionObject()) { domainObject = ((ReadObjectQuery)query).getSelectionObject(); } else { if (isSopQuery && !hasSopObject) { copyInto(domainObject, ((ReadObjectQuery)query).getSelectionObject()); domainObject = ((ReadObjectQuery)query).getSelectionObject();
if (protectedObject == null || query.shouldStoreBypassCache()){ if (query.isReadObjectQuery() && ((ReadObjectQuery)query).shouldLoadResultIntoSelectionObject()) { protectedObject = ((ReadObjectQuery)query).getSelectionObject(); } else { protectedObject = concreteDescriptor.getObjectBuilder().buildNewInstance(); copyInto(protectedObject, ((ReadObjectQuery)query).getSelectionObject()); protectedObject = ((ReadObjectQuery)query).getSelectionObject();