Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-814

[WON'T FIX] Provide a better way to handle polymorphic relationships, eg implement a "PolymorphicNavigator service"

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • core-1.5.0
    • 1.16.0
    • Core
    • None

    Description

      We'd like to be able to decouple modules (eg from Estatio or wherever) and make them reusable for others.

      For example, Estatio has "CommunicationChannel", where its owner is of type CommunicationChannelOwner. We currently use DataNucleus' support for interface mappings, but (because we use annotations) this requires us to list the fully qualified class names of the implementations in the CommunicationChannel; hardly reusable code.

      Naked Objects MVC has a service called the PolymorphicNavigator [1], a mechanism to handle relationships between different Entity Framework contexts, typically via an interface.

      The PolymorphicNavigator requires that all implementations use an int (or long) as their primary key. It then stores the relationship in a separate table, qualified by the object type. This is a bit like DataNucleus' "identity" strategy for mapping interfaces [2], except that:

      • two columns are used, not one (for object type, and object PK
      • the link is held separately from the rest of the object's data.

      [1] https://github.com/NakedObjectsGroup/NakedObjectsFramework/blob/4e860789ad115a38cd3348ceb5c0b141fb0e0d7b/Programming%20Model/NakedObjects.Helpers/Services/PolymorphicNavigator.cs
      [2] http://www.datanucleus.org/products/datanucleus/jdo/orm/interfaces.html

      Attachments

        Activity

          People

            Unassigned Unassigned
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: