/** * INTERNAL: * Execute the query. If there are cached results return those. * This must override the super to support result caching. * * @param session the session in which the receiver will be executed. * @return An object or vector, the result of executing the query. * @exception DatabaseException - an error has occurred on the database */ public Object execute(AbstractSession session, AbstractRecord row) throws DatabaseException { if (shouldCacheQueryResults()) { if (shouldConformResultsInUnitOfWork()) { throw QueryException.cannotConformAndCacheQueryResults(this); } if (isPrepared()) {// only prepared queries can have cached results. Object result = getQueryResults(session, row, true); // Bug6138532 - if result is "cached no results", return null immediately if (result == InvalidObject.instance) { return null; } if (result != null) { if (session.isUnitOfWork()) { result = ((UnitOfWorkImpl)session).registerExistingObject(result); } return result; } } } return super.execute(session, row); }
/** * INTERNAL: * Execute the query. If there are cached results return those. * This must override the super to support result caching. * * @param session the session in which the receiver will be executed. * @return An object or vector, the result of executing the query. * @exception DatabaseException - an error has occurred on the database */ public Object execute(AbstractSession session, AbstractRecord row) throws DatabaseException { if (shouldCacheQueryResults()) { if (shouldConformResultsInUnitOfWork()) { throw QueryException.cannotConformAndCacheQueryResults(this); } if (isPrepared()) {// only prepared queries can have cached results. Object result = getQueryResults(session, row, true); // Bug6138532 - if result is "cached no results", return null immediately if (result == InvalidObject.instance) { return null; } if (result != null) { if (session.isUnitOfWork()) { result = ((UnitOfWorkImpl)session).registerExistingObject(result); } return result; } } } return super.execute(session, row); }
return null; if (shouldConformResultsInUnitOfWork() || this.descriptor.shouldAlwaysConformResultsInUnitOfWork()) { return conformResult(result, unitOfWork, arguments, buildDirectlyFromRows);
/** * INTERNAL: * Execute the query. If there are cached results return those. * This must override the super to support result caching. * * @param session the session in which the receiver will be executed. * @return An object or vector, the result of executing the query. * @exception DatabaseException - an error has occurred on the database */ public Object execute(AbstractSession session, AbstractRecord row) throws DatabaseException { if (shouldCacheQueryResults()) { if (shouldConformResultsInUnitOfWork()) { throw QueryException.cannotConformAndCacheQueryResults(this); } if (isPrepared()) {// only prepared queries can have cached results. Object result = getQueryResults(session, row, true); // Bug6138532 - if result is "cached no results", return null immediately if (result == InvalidObject.instance) { return null; } if (result != null) { if (session.isUnitOfWork()) { result = ((UnitOfWorkImpl)session).registerExistingObject(result); } return result; } } } return super.execute(session, row); }
&& (shouldConformResultsInUnitOfWork() || this.descriptor.shouldAlwaysConformResultsInUnitOfWork())) { return conformResult(result, unitOfWork, arguments, buildDirectlyFromRows);
&& (shouldConformResultsInUnitOfWork() || this.descriptor.shouldAlwaysConformResultsInUnitOfWork())) { return conformResult(result, unitOfWork, arguments, buildDirectlyFromRows);
UnitOfWorkImpl uow = null; if (session.isUnitOfWork()) { conforming = query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork(); uow = (UnitOfWorkImpl)session; if (query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork() || query.shouldCheckCacheOnly() || query.shouldCheckCacheThenDatabase()) { cachedObject = session.getIdentityMapAccessorInstance().getIdentityMapManager().getFromIdentityMap(null, query.getReferenceClass(), translationRow, policyToUse, conforming, false, descriptor); boolean conformingButOutsideUnitOfWork = ((query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork()) && !session.isUnitOfWork()); if ((cachedObject == null) && (conforming || (!query.shouldCheckCacheByPrimaryKey() && !conformingButOutsideUnitOfWork))) {
UnitOfWorkImpl uow = null; if (session.isUnitOfWork()) { conforming = query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork(); uow = (UnitOfWorkImpl)session; if (query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork() || query.shouldCheckCacheOnly() || query.shouldCheckCacheThenDatabase()) { cachedObject = session.getIdentityMapAccessorInstance().getFromIdentityMap(null, query.getReferenceClass(), translationRow, policyToUse, conforming, false, descriptor); boolean conformingButOutsideUnitOfWork = ((query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork()) && !session.isUnitOfWork()); if ((cachedObject == null) && (conforming || (!query.shouldCheckCacheByPrimaryKey() && !conformingButOutsideUnitOfWork))) {
UnitOfWorkImpl uow = null; if (session.isUnitOfWork()) { conforming = query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork(); uow = (UnitOfWorkImpl)session; if (query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork() || query.shouldCheckCacheOnly() || query.shouldCheckCacheThenDatabase()) { cachedObject = session.getIdentityMapAccessorInstance().getFromIdentityMap(null, query.getReferenceClass(), translationRow, policyToUse, conforming, false, descriptor); boolean conformingButOutsideUnitOfWork = ((query.shouldConformResultsInUnitOfWork() || descriptor.shouldAlwaysConformResultsInUnitOfWork()) && !session.isUnitOfWork()); if ((cachedObject == null) && (conforming || (!query.shouldCheckCacheByPrimaryKey() && !conformingButOutsideUnitOfWork))) {