OPENJPA-924: Only cache finder queries without read locks

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@748126 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-02-26 13:04:01 +00:00
parent f5cc8d8b9c
commit bf16127d19
1 changed files with 4 additions and 0 deletions
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel

View File

@ -110,6 +110,8 @@ public class FinderCacheImpl
*/ */
public FinderQuery<ClassMapping,SelectExecutor,Result> public FinderQuery<ClassMapping,SelectExecutor,Result>
get(ClassMapping mapping, FetchConfiguration fetch) { get(ClassMapping mapping, FetchConfiguration fetch) {
if (fetch.getReadLockLevel() != 0)
return null;
boolean ignore = isHinted(fetch, QueryHints.HINT_IGNORE_FINDER); boolean ignore = isHinted(fetch, QueryHints.HINT_IGNORE_FINDER);
boolean invalidate = isHinted(fetch, QueryHints.HINT_INVALIDATE_FINDER); boolean invalidate = isHinted(fetch, QueryHints.HINT_INVALIDATE_FINDER);
if (invalidate) if (invalidate)
@ -143,6 +145,8 @@ public class FinderCacheImpl
(ClassMapping mapping, SelectExecutor select, FetchConfiguration fetch) { (ClassMapping mapping, SelectExecutor select, FetchConfiguration fetch) {
lock(); lock();
try { try {
if (fetch.getReadLockLevel() != 0)
return null;
boolean recache = isHinted(fetch, QueryHints.HINT_RECACHE_FINDER); boolean recache = isHinted(fetch, QueryHints.HINT_RECACHE_FINDER);
if (isExcluded(mapping)) { if (isExcluded(mapping)) {
return recache ? put(mapping, select) : null; return recache ? put(mapping, select) : null;