Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2693

Abstract subentities do not have rows materialized correctly

    XMLWordPrintableJSON

    Details

    • Flags:
      Patch
    • Docs Text:
      Hide
      I haven't forked Cayenne or made a pull request. I just found and hashed this out yesterday afternoon. I have monkey-patched it via the attached file and seems to work. The recursion termination condition in both qualifierForEntityAndSubclasses and entityMatchingRow includes entity's declaredQualifier being null. An abstract subentity can have a null declared qualifier and still have implied qualifiers defined by concrete subentities.
      Show
      I haven't forked Cayenne or made a pull request. I just found and hashed this out yesterday afternoon. I have monkey-patched it via the attached file and seems to work. The recursion termination condition in both qualifierForEntityAndSubclasses and entityMatchingRow includes entity's declaredQualifier being null. An abstract subentity can have a null declared qualifier and still have implied qualifiers defined by concrete subentities.

      Description

      Given an inheritance tree such as (qualifiers are in parentheses):

      abstract class A

      concrete class B extends A (type = 0)

      abstract class C extends A

      concrete class D extends C (type = 1)

      concrete class E extends C (type=2)

      and single-table inheritance.

      When querying on class A and results include a row of type D, EntityInheritanceTree will return C as the matching entity. In fact, even if the results include a row of type B, if entityMatchingRow will return C if it is checked before entity B.

      Also, qualifierForEntityAndSubclasses will return a null qualifier for type C when it should really return (type =1) or (type = 2).

       

        Attachments

        1. EntityInheritanceTree.java
          7 kB
          John Larson

          Activity

            People

            • Assignee:
              ntimofeev Nikita Timofeev
              Reporter:
              larsonja John Larson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified