From ddf40eb5c4203793f39f75ce55aa891bde8e0071 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 31 Jul 2007 02:09:32 +0000 Subject: [PATCH] Always use an explicit query if we aren't using a cache. --- src/java/com/samskivert/jdbc/depot/DepotRepository.java | 3 ++- .../com/samskivert/jdbc/depot/PersistenceContext.java | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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. */