cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAY-2101) DataContext.currentSnapshot() doesn't set snapshot entity name
Date Fri, 12 Aug 2016 07:42:20 GMT

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

Andrus Adamchik commented on CAY-2101:
--------------------------------------

Here is the stack showing the consequences of a bad snapshot:

 java.lang.reflect.Constructor.newInstance(Constructor.java:423)
java.lang.Class.newInstance(Class.java:442)
org.apache.cayenne.reflect.PersistentDescriptor.createObject(PersistentDescriptor.java:321)
org.apache.cayenne.reflect.LazyClassDescriptorDecorator.createObject(LazyClassDescriptorDecorator.java:73)
org.apache.cayenne.access.DataContext.findOrCreateObject(DataContext.java:1179)
org.apache.cayenne.access.ObjectResolver.objectFromDataRow(ObjectResolver.java:142)
org.apache.cayenne.access.ObjectResolver.objectFromDataRow(ObjectResolver.java:130)
org.apache.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResolver.java:114)
org.apache.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows(ObjectResolver.java:95)
org.apache.cayenne.access.ObjectResolver.synchronizedRootResultNodeFromDataRows(ObjectResolver.java:86)
org.apache.cayenne.access.DataDomainQueryAction$ObjectConversionStrategy.toResultsTree(DataDomainQueryAction.java:639)
org.apache.cayenne.access.DataDomainQueryAction$SingleObjectConversionStrategy.convert(DataDomainQueryAction.java:680)
org.apache.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:503)
org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:130)
org.apache.cayenne.access.DataDomain.onQueryNoFilters(DataDomain.java:559)
org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:730)
org.apache.cayenne.tx.TransactionFilter.onQuery(TransactionFilter.java:49)
org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:730)
org.apache.cayenne.lifecycle.audit.AuditableFilter.onQuery(AuditableFilter.java:78)
org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:730)
org.apache.cayenne.lifecycle.relationship.ObjectIdRelationshipFilter.onQuery(ObjectIdRelationshipFilter.java:65)
org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:730)
org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:730)
org.apache.cayenne.lifecycle.changeset.ChangeSetFilter.onQuery(ChangeSetFilter.java:54)
org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:730)
org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:551)
org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:384)
org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(ObjectContextQueryAction.java:107)
org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:94)
org.apache.cayenne.access.DataContext.onQuery(DataContext.java:982)
org.apache.cayenne.access.DataContext.performQuery(DataContext.java:971)
org.apache.cayenne.access.ToOneFault.doResolveFault(ToOneFault.java:81)
org.apache.cayenne.access.ToOneFault.resolveFault(ToOneFault.java:54)
org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:180)
foo.model.auto._Related.getObject(_Related.java:29) 

> DataContext.currentSnapshot() doesn't set snapshot entity name
> --------------------------------------------------------------
>
>                 Key: CAY-2101
>                 URL: https://issues.apache.org/jira/browse/CAY-2101
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 4.0.M3, 3.1.2
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>
> DataContext.currentSnapshot() fails to set created snapshot entity name. This causes
confusion downstream. One obscure case that I was finally able to trace to this issue was
related to inheritance:
> * "currentSnapshot" was called for concrete subclass during new object commit.
> * returned snapshot ended up in the shared cache
> * later a RelationshipQuery for another object pointing to this one received the snapshot
from cache.
> * The result was the attempt to instantiate an abstract superclass instead of subclass

> So we need to fix 'currentSnapshot' and maybe also add sanity checks to "objectsFromDataRows"
to throw on invalid snapshots.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message