This is a good reminder, but sorry i'ts out of subject ;o)

Even if I replace findByPrimaryKey by findOne (actually findByPrimaryKey simply 
calls findOne and I agree we should do, there is
still a lot  to do in current OOTB code: 1169 instances in Java and Groovy 
files) I will still wonder why not using findOne with
useCache=true everywhere

I see there is a little overhead in code due to calls to ecaRunner.evalRules 
with EV_CACHE_CHECK/ EV_CACHE_PUT and
getFromPrimaryKeyCache/putInPrimaryKeyCache when actually the entity is not 
cacheable but it would be largely compensated by real
use of cache when it's cacheable since it's most cases. To optimize, for the 
cases the entity is not cacheable , we could then later
replace useCache=true by false

Do I miss something?

Jacques

From: "Ruth Hoffman" <[email protected]>
Hi Adrian:
Thanks much for your quick reply.
Best Regards,
Ruth

On 4/21/11 11:05 AM, Adrian Crum wrote:
From what I recall, there is no difference in functionality. The deprecated 
methods were merely an effort to simplify the
Delegator API.

-Adrian

On 4/21/2011 8:02 AM, Ruth Hoffman wrote:
Hi Adrian:

I thought I had seen something like that somewhere. Thanks for the reference. 
Do you recall if there is someplace that explains
the improvements in findOne over findByPrimaryKey?

Best Regards,
Ruth

On 4/21/11 10:57 AM, Adrian Crum wrote:
http://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/entity/Delegator.html#findByPrimaryKey%28java.lang.String,%20java.util.Map%29

-Adrian

On 4/21/2011 7:52 AM, Ruth Hoffman wrote:
Hi Jacques:
Out of curiosity, I have often wondered about this:
For my own coding, should I use findByPrimaryKey or findOne? Which is the 
"better" solution? Regardless of Java, Groovy or
other?
TIA
Ruth

On 4/21/11 4:11 AM, Jacques Le Roux wrote:
Hi,

It would not be a big work effort to replace,and later use only, all 
findByPrimaryKey, findByAnd and also findList in Groovy
and Java files by their cache overloads (or useCache for findList).
Is there a reason it has not been done yet? I can't see one.

Thanks

Jacques







Reply via email to