Always use an explicit query if we aren't using a cache.

This commit is contained in:
Michael Bayne
2007-07-31 02:09:32 +00:00
parent 92c54a5325
commit ddf40eb5c4
2 changed files with 10 additions and 1 deletions
@@ -148,7 +148,8 @@ public abstract class DepotRepository
throws PersistenceException
{
DepotMarshaller<T> marsh = _ctx.getMarshaller(type);
boolean useExplicit = (marsh.getTableName() == null) || !marsh.hasPrimaryKey();
boolean useExplicit =
(marsh.getTableName() == null) || !marsh.hasPrimaryKey() || !_ctx.isUsingCache();
// TODO: This is a very conservative approach where all complicated queries are handled
// TODO: with the traditional single-pass query. The double pass algorithm can handle a
@@ -264,6 +264,14 @@ public class PersistenceContext
return rows;
}
/**
* Returns true if there is a {@link CacheAdapter} configured, false otherwise.
*/
public boolean isUsingCache ()
{
return _cache != null;
}
/**
* Looks up an entry in the cache by the given key.
*/