cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Razumovsky (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAY-1399) Serializing issue: getRootDbEntity and getRootEntity of QueryAssembler must use entityResolver always for avoiding to use deserialized QueryMetadata
Date Fri, 05 Mar 2010 10:34:27 GMT

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

Andrey Razumovsky commented on CAY-1399:
----------------------------------------

SelectTranslator object is created per every request. So you must be (de)serializing data
in the middle of query construction?

> 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message