/** * PUBLIC: * The cache will checked completely, if the object is not found null will be returned or an error if the query is too complex. * Queries can be configured to use the cache at several levels. * Other caching option are available. * @see #setCacheUsage(int) */ public void checkCacheOnly() { setCacheUsage(CheckCacheOnly); }
/** * PUBLIC: * This can be used to explicitly disable the cache hit. * The cache hit may not be desired in some cases, such as * stored procedures that accept the primary key but do not query on it. */ public void dontCheckCache() { setCacheUsage(DoNotCheckCache); }
/** * PUBLIC: * This can be used to explicitly disable the cache hit. * The cache hit may not be desired in some cases, such as * stored procedures that accept the primary key but do not query on it. */ public void dontCheckCache() { setCacheUsage(DoNotCheckCache); }
/** * PUBLIC: * This can be used to explicitly disable the cache hit. * The cache hit may not be desired in some cases, such as * stored procedures that accept the primary key but do not query on it. */ public void dontCheckCache() { setCacheUsage(DoNotCheckCache); }
/** * PUBLIC: * The cache will checked completely, if the object is not found the database will be queried, * and the database result will be verified with what is in the cache and/or unit of work including new objects. * This can lead to poor performance so it is recommended that only the database be queried in most cases. * Queries can be configured to use the cache at several levels. * Other caching option are available. * @see #setCacheUsage(int) */ public void conformResultsInUnitOfWork() { setCacheUsage(ConformResultsInUnitOfWork); }
/** * PUBLIC: * The cache will checked completely, if the object is not found null will be returned or an error if the query is too complex. * Queries can be configured to use the cache at several levels. * Other caching option are available. * @see #setCacheUsage(int) */ public void checkCacheOnly() { setCacheUsage(CheckCacheOnly); }
/** * PUBLIC: * The cache will checked completely, if the object is not found the database will be queried, * and the database result will be verified with what is in the cache and/or unit of work including new objects. * This can lead to poor performance so it is recommended that only the database be queried in most cases. * Queries can be configured to use the cache at several levels. * Other caching option are available. * @see #setCacheUsage(int) */ public void conformResultsInUnitOfWork() { setCacheUsage(ConformResultsInUnitOfWork); }
/** * PUBLIC: * The cache will checked completely, if the object is not found null will be returned or an error if the query is too complex. * Queries can be configured to use the cache at several levels. * Other caching option are available. * @see #setCacheUsage(int) */ public void checkCacheOnly() { setCacheUsage(CheckCacheOnly); }
/** * PUBLIC: * The cache will checked completely, if the object is not found the database will be queried, * and the database result will be verified with what is in the cache and/or unit of work including new objects. * This can lead to poor performance so it is recommended that only the database be queried in most cases. * Queries can be configured to use the cache at several levels. * Other caching option are available. * @see #setCacheUsage(int) */ public void conformResultsInUnitOfWork() { setCacheUsage(ConformResultsInUnitOfWork); }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (query.isObjectLevelReadQuery()) { int cacheUsage = ((Integer)valueToApply).intValue(); ((ObjectLevelReadQuery)query).setCacheUsage(cacheUsage); if (cacheUsage == ObjectLevelReadQuery.CheckCacheByExactPrimaryKey || cacheUsage == ObjectLevelReadQuery.CheckCacheByPrimaryKey || cacheUsage == ObjectLevelReadQuery.CheckCacheThenDatabase) { ReadObjectQuery newQuery = new ReadObjectQuery(); newQuery.copyFromQuery(query); return newQuery; } } else if (query.isModifyAllQuery()) { int cacheUsage = ((Integer)valueToApply).intValue(); ((ModifyAllQuery)query).setCacheUsage(cacheUsage); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
cloneSharedQuery(); query = getDatabaseQueryInternal(); ((ObjectLevelReadQuery)query).setCacheUsage(ObjectLevelReadQuery.UseDescriptorSetting); shouldResetConformResultsInUnitOfWork = true;