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

Brian Dickinson edited comment on CAY-596 at 1/23/13 5:12 AM:
--------------------------------------------------------------

We have definitely had issues with stale cache data.  It only seems to happen 
occasionally.  One thread makes an update and another thread keeps retrieving 
the old data.   In one case we basically have a thread that checks 
order.getOrderItems every few seconds.  If all of the order items are completed 
then the thread can exit but sometimes it never does.  We can see that the 
changes were committed to the database, but they don't propagate back to the 
other thread.  We have had to work around this by either passing any desired 
updates into the thread that does the checking and allowing it to make the 
changes, or by explicitly refreshing from the database occasionally.   We 
haven't had any issues with the workarounds in place.  We are using the shared 
object cache exclusively. Cayenne version is 3.0.1. 

There is another issue where a map.containsKey fails to match on an object id, 
this time using orderItem.getOrder().getId() for the object it is trying to 
match.  We had logging on this to verify that the key was actually in the map.  
I am not entirely sure, but I don't think this sort of thing happens without 
navigating through an association.  It seems like the object ids can get 
mutated somehow through associations.  
                
      was (Author: bdickinson):
    We have definitely had issues with stale cache data.  It only seems to 
happen occasionally.  One thread makes an update and another thread keeps 
retrieving the old data.   In one case we basically have a thread that checks 
order.getOrderItems every few seconds.  If all of the order items are completed 
then the thread can exit but sometimes it never does.  We can see that the 
changes were committed to the database, but they don't propagate back to the 
other thread.  We have had to work around this by either passing any desired 
updates into the thread that does the checking and allowing it to make the 
changes, or by explicitly refreshing from the database occasionally.   We 
haven't had any issues with the workarounds in place.  We are using the shared 
object cache exclusively. Cayenne version is 3.0.1. 
                  
> DataObject cache works incorrect !
> ----------------------------------
>
>                 Key: CAY-596
>                 URL: https://issues.apache.org/jira/browse/CAY-596
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 1.2 branch
>         Environment: Windows XP,  1.4.2_06 by Sun Microsystems Inc., DB 
> Oracle 
>            Reporter: Paul Ponec
>            Priority: Critical
>
> Data object util method: 
>         DataObjectUtils.objectForPK(context, persistentClass, (Object) id);
> returns sometimes (freqency 30% on my sample) a DataObject with an old 
> property value.
> If I am using code:
>         Expression expr = ExpressionFactory.matchExp("id", id);
>         SelectQuery query = new SelectQuery(persistentType, expr);
>         List list = context.performQuery(query);
>         return list.size()==1 ? list.get(0) : null;
> then result (all object properties) is OK always.
> ---
> A selection from map.xml:
> <db-entity name="CALL" schema="TEST">
>               <db-attribute name="id" type="NUMERIC" isPrimaryKey="true" 
> isMandatory="true"/>
>               <db-attribute name="sign" type="VARCHAR" length="1"/>
> </db-entity>
> <obj-entity name="Call" className="xxx.Call" dbEntityName="CALL">
>               <obj-attribute name="id" type="java.math.BigDecimal" 
> db-attribute-path="id"/>
>               <obj-attribute name="sign" type="java.lang.String" 
> db-attribute-path="sign"/>
> </obj-entity>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to