[ 
https://issues.apache.org/jira/browse/CAY-2748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17564445#comment-17564445
 ] 

John Huss edited comment on CAY-2748 at 7/8/22 7:51 PM:
--------------------------------------------------------

There are two ways to address this issue and I'm not sure which one is 
preferred.

1) Make defensive copy when data is retrieved from the local cache. The 
downside here is it causes paged queries (using .pageSize(int)) to lose the 
incremental nature provided by IncrementalFaultList

2) Return an unmodifiableList. The downside there is that it could break 
existing code that mutates the list. But this will seems preferable since it 
will perform better and doesn't affect paged queries.


was (Author: johnthuss):
There are two ways to address this issue and I'm not sure which one is 
preferred.

1) Make defensive copy when data is retrieved from the local cache. The 
downside here is it causes paged queries (using .pageSize(x) to lose the 
incremental nature provided by IncrementalFaultList

2) Return an unmodifiableList. The downside there is that it could break 
existing code that mutates the list. But this will seems preferable since it 
will perform better and doesn't affect paged queries.

> Mutating the list returned from the local query cache changes the cache
> -----------------------------------------------------------------------
>
>                 Key: CAY-2748
>                 URL: https://issues.apache.org/jira/browse/CAY-2748
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 4.1.1, 4.2.RC1, 4.3.M1
>            Reporter: John Huss
>            Assignee: John Huss
>            Priority: Minor
>             Fix For: 4.3.M1
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> If you perform a query that populates the local query cache and then mutate 
> the returned list (by adding an object), this mutation will persist inside 
> the local query cache so that subsequent queries that hit the local query 
> cache will incorrectly include this mutation. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to