diff --git a/src/java/com/samskivert/jdbc/depot/DepotRepository.java b/src/java/com/samskivert/jdbc/depot/DepotRepository.java index d116c10..cee88ec 100644 --- a/src/java/com/samskivert/jdbc/depot/DepotRepository.java +++ b/src/java/com/samskivert/jdbc/depot/DepotRepository.java @@ -148,7 +148,8 @@ public abstract class DepotRepository throws PersistenceException { DepotMarshaller 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 diff --git a/src/java/com/samskivert/jdbc/depot/PersistenceContext.java b/src/java/com/samskivert/jdbc/depot/PersistenceContext.java index 387d4bb..e4115d5 100644 --- a/src/java/com/samskivert/jdbc/depot/PersistenceContext.java +++ b/src/java/com/samskivert/jdbc/depot/PersistenceContext.java @@ -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. */