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/24 23:12:04 UTC
[jira] [Created] (OLINGO-740) Association does not get created when
there are multiple relationships between 2 tables
arathi m created OLINGO-740:
-------------------------------
Summary: 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
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)