You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "arathi m (JIRA)" <ji...@apache.org> on 2015/07/31 20:19:04 UTC

[jira] [Resolved] (OLINGO-740) Association does not get created when there are multiple relationships between 2 tables

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

arathi m resolved OLINGO-740.
-----------------------------
       Resolution: Duplicate
    Fix Version/s: V2 2.0.5

> Association does not get created when there are multiple relationships between 2 tables
> ---------------------------------------------------------------------------------------
>
>                 Key: OLINGO-740
>                 URL: https://issues.apache.org/jira/browse/OLINGO-740
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.5
>            Reporter: arathi m
>            Assignee: Chandan V.A
>             Fix For: V2 2.0.5
>
>
> I have 2 DB tables with multiple associations between them
> Table A (id, name, tableb_id)
> Table B (id, name tablea_id)
> First, an association gets correctly created for tableA with the name TableA_TableB. While creating an association for TableB, the code searches for an association named "TableA_TableB" instead of searching/creating "TableB_TableA" association. The faulty code is at 
> org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmNameBuilder.build()
>    if (end1Name.equals(end2Name)) {
>       associationName = end1Name + UNDERSCORE + end2Name;
>       associationName =
>           associationName + UNDERSCORE + multiplicityToString(association.getEnd1().getMultiplicity()) + UNDERSCORE
>               + multiplicityToString(association.getEnd2().getMultiplicity()) + Integer.toString(count);
>     } else {
>     if (end1Name.compareToIgnoreCase(end2Name) > 0) {
>         associationName = end2Name + UNDERSCORE + end1Name;
>       } else {
>         associationName = end1Name + UNDERSCORE + end2Name;
>       }
>     	associationName = end1Name + UNDERSCORE + end2Name;
>       if (count >= 1) {
>         associationName = associationName + Integer.toString(count - 1);
>       }
> The fix is to create associationName = end1Name+UNDERSCORE+end2Name
> instead of arranging the names in ascending order.



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