From a60eab750470953dee10735a0d363b7f84167cf8 Mon Sep 17 00:00:00 2001 From: mdb Date: Tue, 31 Jul 2007 02:09:32 +0000 Subject: [PATCH] Always use an explicit query if we aren't using a cache. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2155 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- 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 d116c100..cee88ec6 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 387d4bbd..e4115d5d 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. */