Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    question about relatedTableAlias and multiple indirection

    SmartClient Version: SNAPSHOT_v12.1d_2019-07-20/Enterprise Deployment (built 2019-07-20)

    Hello, I've just realized that in case of multiple indirection, the table alias is generated like this (from the docs):

    Code:
    It is also allowed to specify a series of FK fields in includeVia, for example "moneyTransferDetail" could declare:  
        <field name="mainSourceCurrencyGroup" includeFrom="moneyTransfer.currency.currencyGroup.groupName" includeVia="mtId.sourceCurId"/>    <field name="mainPaymentCurrencyGroup" includeFrom="moneyTransfer.currency.currencyGroup.groupName" includeVia="mtId.paymentCurId"/>   In this case the prefix used for table aliases will be the includeVia value with "_" substituted for ".", so the table aliases will be "mtId_sourceCurId_group" and "mtId_paymentCurId_group".
    Actually I was convinced that the framework would use the concatenation of the relatedTableAlias attributes for the foreignKeys involved.
    I found this a bit counter-intuitive.
    Also, with oracle database, when the alias is longer than 30 characters, it requires to shorten the fields name, instead of shortening the relatedTableAlias, which to me seems better for readability.

    Moreover, now the alias is composed from the concatenation of two field names + a related table alias, so will probably be longer than the concatenation of two relatedTableAlias.
    May I ask if it's actually intended behaviour?
    Last edited by claudiobosticco; 24 Jul 2019, 05:00.

    #2
    This was intentional, but your suggestion makes sense. We made changes to favour relatedTableAlias (if present) over FK field name in generated aliases, they will be available for download in nightly builds since Nov 14 (today).

    Comment


      #3
      Thanks, may I ask which is the behaviour when not all FK fields involved have the relatedTableAlias attribute defined?

      Comment


        #4
        Also, note that I've got a dataSource where previously I was counting on the 'old' behaviour alias in custom querying, so I have to correct it. Maybe this change in default behaviour could not be ideal for all users?

        Comment


          #5
          I'm also wondering...is it really necessary to concatenate all the relatedTableAlias(es) ?

          Edit: nevermind, I see it's necessary, in general
          Last edited by claudiobosticco; 11 Dec 2019, 01:22.

          Comment

          Working...
          X