You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Bryan Lewis (JIRA)" <ji...@apache.org> on 2012/05/03 18:48:49 UTC

[jira] [Commented] (CAY-596) DataObject cache works incorrect !

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

Bryan Lewis commented on CAY-596:
---------------------------------

I've had issues like this, although I never could pin it down reliably.  I tried making a test case twice, but the problem never happened in the test cases.

The most frequent failure for me was in a Tapestry CRUD page editing a main item, where an object got added or deleted from a to-many relationship ina  secondary detail-editor page.  When the main page re-rendered the item didn't show the change.  I worked around it on a page-by-page basis, invalidating the item after such an add/delete operation.  It happened on more and more pages, the most recent case being a change in a simple attribute not appearing.

Finally I realized that few of my pages were trusting the object cache, so I switched my Tapestry encoder from DataObjectUtils.objectForPK() to a refetch with an ObjectIdQuery(id, CACHE_REFRESH).  It takes only a few milliseconds to refetch an item.
                
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira