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] [Comment Edited] (CAY-2113) cdbimport: Reverse-engineering reinstates previously ignored columns
Date Wed, 28 Sep 2016 14:10:21 GMT

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

Andrus Adamchik edited comment on CAY-2113 at 9/28/16 2:09 PM:
---------------------------------------------------------------

The cause is the following code in AbstractToModelToken class (called from subclasses) :

{noformat}
 public void execute(MergerContext mergerContext) {
        getEntity().addAttribute(getColumn());
        synchronizeWithObjEntity(getEntity());
        mergerContext.getModelMergeDelegate().dbAttributeAdded(getColumn());
    }
{noformat}

Here 'synchronizeWithObjEntity' is called for the entire DbEntity, regardless of the scope
of the token change. So it overrides custom settings. And also degrades performace as 'synchronizeWithObjEntity'
is called it for every token, so it may be called multiple times for the same entity. Any
fix that replaces 'synchronizeWithObjEntity'  with token-specific code will hopefully solve
both problems. This affects the following Token classes:

* AddColumnToModel
* AddRelationshipToModel
* CreateTableToModel (this one can legitimately call 'synchronizeWithObjEntity' actually)


was (Author: andrus):
The cause is the following code in AbstractToModelToken class (called from subclasses) :

{noformat}
 public void execute(MergerContext mergerContext) {
        getEntity().addAttribute(getColumn());
        synchronizeWithObjEntity(getEntity());
        mergerContext.getModelMergeDelegate().dbAttributeAdded(getColumn());
    }
{noformat}

Here 'synchronizeWithObjEntity' is called for the entire DbEntity, regardless of the scope
of the token change. So it overrides custom settings. And also degrades performace as 'synchronizeWithObjEntity'
is called it for every token, so it may be called multiple times for the same entity. Any
fix that replaces 'synchronizeWithObjEntity'  with token-specific code will hopefully solve
both problems. This affects the following Token classes:

* AddColumnToModel
* AddRelationshipToModel
* CreateTableToModel

> cdbimport: Reverse-engineering reinstates previously ignored columns
> --------------------------------------------------------------------
>
>                 Key: CAY-2113
>                 URL: https://issues.apache.org/jira/browse/CAY-2113
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 4.0.M3
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>
> Say we have a model:
> {noformat}
> T1:
>    ID
>    C1
>    C2
> O1 -> T1
>    c1 -> T1.C1
> {noformat}
> I.e. our ObjEntity intentionally does not map certain columns. Now we add a column T1.C3
and rerun cdbimport. The end result is 2 new attributes: c2 and c3. Expected - just c3. Removal
of "c2" was an earlier user decision and we should not recreate it.



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

Mime
View raw message