You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2007/03/09 13:32:17 UTC

svn commit: r516391 - in /cayenne/main/branches/STABLE-2.0/cayenne: cayenne-java/src/cayenne/java/org/apache/cayenne/access/DataDomain.java cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt

Author: aadamchik
Date: Fri Mar  9 04:32:16 2007
New Revision: 516391

URL: http://svn.apache.org/viewvc?view=rev&rev=516391
Log:
CAY-765 Programmatically overriding "use share cache" fails - 2.0 fix

Modified:
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/access/DataDomain.java
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/access/DataDomain.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/access/DataDomain.java?view=diff&rev=516391&r1=516390&r2=516391
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/access/DataDomain.java (original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/access/DataDomain.java Fri Mar  9 04:32:16 2007
@@ -303,7 +303,8 @@
     /**
      * Returns <code>true</code> if DataContexts produced by this DataDomain are using
      * shared DataRowStore. Returns <code>false</code> if each DataContext would work
-     * with its own DataRowStore.
+     * with its own DataRowStore. Note that this setting can be overwritten per
+     * DataContext. See {@link #createDataContext(boolean)}.
      */
     public boolean isSharedCacheEnabled() {
         return sharedCacheEnabled;
@@ -383,7 +384,7 @@
 
     /**
      * Returns snapshots cache for this DataDomain, lazily initializing it on the first
-     * call.
+     * call if 'sharedCacheEnabled' flag is true.
      */
     public synchronized DataRowStore getSharedSnapshotCache() {
         if (sharedSnapshotCache == null && sharedCacheEnabled) {
@@ -392,6 +393,21 @@
 
         return sharedSnapshotCache;
     }
+    
+    /**
+     * Returns a guaranteed non-null shared snapshot cache regardless of the
+     * 'sharedCacheEnabled' flag setting. This allows to build DataContexts that do not
+     * follow the default policy.
+     * 
+     * @since 3.0
+     */
+    synchronized DataRowStore nonNullSharedSnapshotCache() {
+        if (sharedSnapshotCache == null) {
+            this.sharedSnapshotCache = new DataRowStore(name, properties, eventManager);
+        }
+
+        return sharedSnapshotCache;
+    }
 
     /**
      * Shuts down the previous cache instance, sets cache to the new DataSowStore instance
@@ -552,7 +568,7 @@
         // for new dataRowStores use the same name for all stores
         // it makes it easier to track the event subject
         DataRowStore snapshotCache = (useSharedCache)
-                ? getSharedSnapshotCache()
+                ? nonNullSharedSnapshotCache()
                 : new DataRowStore(name, properties, eventManager);
 
         DataContext context;

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt?view=diff&rev=516391&r1=516390&r2=516391
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt (original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-other/release-notes/RELEASE-NOTES-2.0-SNAPSHOT.txt Fri Mar  9 04:32:16 2007
@@ -20,6 +20,8 @@
 CAY-751 AS400 datafields containing # in field names do not get mapped correctly
 CAY-752 Importing EOModel gives Cast Exception
 CAY-754 Local jNDI hack breaks when running with Jetty6-Maven
+CAY-764 Exception when importing an EOModel with single table inheritance
+CAY-765 Programmatically overriding "use share cache" fails
 
 ----------------------------------
 Release: 2.0.2