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

Andrus Adamchik commented on CAY-1779:
--------------------------------------

Hi Ilya,

thanks for the patches!  A few comments:

1. We are trying to avoid star imports like "import org.apache.cayenne.map.*", 
importing all dependent classes explicitly instead. Of course this rule is not 
documented anywhere, so you have to take my word for it here :)

2. Dependency on commons-lang: Validate.notNull(entityValue); Cayenne does not 
have direct dependency on commons-lang (and in general tries to avoid using 
third-party frameworks, even the Apache ones, for simple tasks). Even though 
commons-lang unfortunately creeps in as a transitive dep via velocity 
(something we may deal with at some point), in our main code we should avoid 
using it directly.

3.  A separate "optimisation" package for ManyToManyCandidateEntity... I think 
in the current state of things ManyToManyCandidateEntity should be made 
non-public member of the "access" package. As of now it does not warrant a 
package of its own.

4. 'isRepresentManyToManyTable' criteria ... This is the only "algorithmic" 
issue with the patch (the rest was "flavor" :)) In the code below we will need 
to extend the criteria a bit... An entity should only be  "flattened" when all 
the underlying table columns can be propagated from other tables.

+    public boolean isRepresentManyToManyTable() {
+        boolean hasTwoRelationships = entity.getRelationships().size() == 2;
+        boolean isNotHaveAttributes = entity.getAttributes().size() == 0;
+
+        return hasTwoRelationships && isNotHaveAttributes &&
+                isTargetEntitiesIsDifferent();
+    }
                
> Remove temporary object entities for many to many relationship on reverse 
> engineering
> -------------------------------------------------------------------------------------
>
>                 Key: CAY-1779
>                 URL: https://issues.apache.org/jira/browse/CAY-1779
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Modeler, Non-GUI Tools
>    Affects Versions: 3.2M1
>            Reporter: Ilya Drabenia
>              Labels: features
>         Attachments: 
> 0001-CAY-1779-Remove-temporary-object-entities-for-many-t.patch, 
> 0002-CAY-1779-Remove-temporary-object-entities-for-many-t.patch
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> Need to remove temporary object entities for many to many relationship on 
> reverse engineering. And make flattened relationships direct to both tables 
> that take part in relation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to