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] [Closed] (CAY-1399) Serializing issue: getRootDbEntity and getRootEntity of QueryAssembler must use entityResolver always for avoiding to use deserialized QueryMetadata
Date Sun, 25 Dec 2016 13:09:58 GMT

     [ https://issues.apache.org/jira/browse/CAY-1399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andrus Adamchik closed CAY-1399.
--------------------------------
    Resolution: Cannot Reproduce

If this is still an issue with 4.0.M4 (and considering Andrey's comment), please reopen.

> Serializing issue: getRootDbEntity and getRootEntity of QueryAssembler must use entityResolver
always for avoiding to use deserialized QueryMetadata
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAY-1399
>                 URL: https://issues.apache.org/jira/browse/CAY-1399
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0RC2
>         Environment: on every platform. You will often see this problem on low-memory
machine.
>            Reporter: Tsutomu YANO
>
> getRootDbEntity() and getRootEntity() methods of QueryAssembler are now using QueryMetadata
object to resolve DbEntity and ObjEntity in some situation.
> But QueryMetadata instance is serializable. So the instance and the instances in the
QueryMetadata will become another instance when QueryMetadata was deserialized. Because of
that, DbEntities and ObjEntities will not be same with instances resolved from EntityResolver.
EntityResolver will always returns current instance (not deserialized one).
> In org.apache.cayenne.access.trans.SelectTranslator, 'appendColumn' method uses a HashSet
to avoid creating multiple ColumnDescriptor for a same column. If all DbAttribute passed to
the appendColumn method  are resolved from EntityResolver, No problem.
> But in SelectTranslator, you resolve DbAttribute (and DbEntity) sometimes with getRootDbEntity()
of SelectTranslator, sometimes with EntityResolver (through ClassDescripter).
> getRootDbEntity() method uses QueryMetadata to retrieve DbEntity. the QueryMetadata could
be a deserialized object. If so, DbEntities in QueryMetada is not same instances resolved
with EntityResolver.  If other instance of same DbAttribute appears, the HashSet used in 'appendColumn'
method do not work correctly, 
> I think getRootDbEntity() and getRootEntity() must use EntityResolver always. Like bellow:
> ---- CODE SAMPLE ---
> public DbEntity getRootDbEntity() {
>     ObjEntity objEntity = getRootEntity();
>     if(objEntity == null) return null;
>     return objEntity.getDbEntity();
> }
> public ObjEntity getRootEntity() {
>     ObjEntity objEntity = queryMetadata.getObjEntity();
>     if(objEntity == null) return null;
>     return getEntityResolver().getObjEntity(objEntity.getName());
> }
> ---- END ---
> Thanks.



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

Mime
View raw message