/** * INTERNAL: * Check if the target object is in the cache if possible based on the target key value. * Return null if the target key is not the primary key, or if the query is refreshing. */ @Override protected Object checkCacheForBatchKey(AbstractRecord sourceRow, Object foreignKey, Map batchObjects, ReadQuery batchQuery, ObjectLevelReadQuery originalQuery, AbstractSession session) { if (((ReadAllQuery)batchQuery).shouldRefreshIdentityMapResult() || (!((ReadAllQuery)batchQuery).shouldMaintainCache())) { return null; } // Check the cache using the source row and selection query. Object cachedObject = this.selectionQuery.checkEarlyReturn(session, sourceRow); if ((cachedObject != null) && (batchObjects != null)) { batchObjects.put(foreignKey, cachedObject); } return cachedObject; }
/** * INTERNAL: * Check if the target object is in the cache if possible based on the target key value. * Return null if the target key is not the primary key, or if the query is refreshing. */ @Override protected Object checkCacheForBatchKey(AbstractRecord sourceRow, Object foreignKey, Map batchObjects, ReadQuery batchQuery, ObjectLevelReadQuery originalQuery, AbstractSession session) { if (((ReadAllQuery)batchQuery).shouldRefreshIdentityMapResult() || (!((ReadAllQuery)batchQuery).shouldMaintainCache())) { return null; } // Check the cache using the source row and selection query. Object cachedObject = this.selectionQuery.checkEarlyReturn(session, sourceRow); if ((cachedObject != null) && (batchObjects != null)) { batchObjects.put(foreignKey, cachedObject); } return cachedObject; }
/** * 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()); }
batchQuery.setShouldRefreshIdentityMapResult(query.shouldRefreshIdentityMapResult()); batchQuery.setCascadePolicy(query.getCascadePolicy()); batchQuery.setShouldMaintainCache(query.shouldMaintainCache());