[
https://issues.apache.org/jira/browse/OFBIZ-5332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adrian Crum closed OFBIZ-5332.
------------------------------
Resolution: Fixed
Fix Version/s: SVN trunk
Fixed in rev 1527626.
> GenericDelegator failed to cache NULL_VALUE
> -------------------------------------------
>
> Key: OFBIZ-5332
> URL:
https://issues.apache.org/jira/browse/OFBIZ-5332> Project: OFBiz
> Issue Type: Bug
> Components: framework
> Affects Versions: SVN trunk
> Reporter: Sam Ng
> Assignee: Adrian Crum
> Priority: Minor
> Fix For: SVN trunk
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> GenericeDelegator should determine if the value is GenericValue.NULL_VALUE inside findOne(), otherwise, NULL_VALUE will be considered as cache missed.
> And I have searched, although getFromPrimaryKeyCache() is public, but findOne() is the caller, so it is safe to change it's behavior.
> According to my own test, if we fix this bug, about 1/3 of the DB queries will be removed (cache hit).
> public GenericValue findOne(String entityName, Map<String, ? extends Object> fields, boolean useCache) throws GenericEntityException {
> ....
> if (useCache) {
> ...
> GenericValue value = this.getFromPrimaryKeyCache(primaryKey);
> if (value != null) {
> //========== change the following two line ==========
> if ( value == GenericValue.NULL_VALUE ) return null;
> else return value;
> }
> }
> public GenericValue getFromPrimaryKeyCache(GenericPK primaryKey) {
> .....
> GenericValue value = cache.get(primaryKey);
> //========== remove the following three lines ==========
> // if (value == GenericValue.NULL_VALUE) {
> // return null;
> //}
> return value;
> }
--
This message was sent by Atlassian JIRA
(v6.1#6144)