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

Wrong resolution of ExtendedType with ValueObjectType for inherited class

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.B2, 4.1.M1
    • Fix Version/s: 4.0.RC1, 4.1.M2
    • Component/s: Core Library
    • Labels:
      None

      Description

      Real world problem: we have class Money that extends BigDecimal and ValueObjectType that maps Money.class to BigDecimal.class.
      But still BigDecimalType is used for attributes of type Money.

      The reason for this is that every registration of ExtendedType also creates factory that maps all subclasses to that type. I.e. in our case this factory returns BigDecimalType before we can get registered ValueObjectType.

      After some thoughts this subclass usage is a faulty behavior, as we can't assume anything about compatibility of this two classes. E.g. in our case there is no chance that we can interchange Money and BigDecimal. Moreover since 4.1 this behavior leads to immediate ClassCastException when trying to write such property into an object.

        Attachments

          Activity

            People

            • Assignee:
              ntimofeev Nikita Timofeev
              Reporter:
              ntimofeev Nikita Timofeev
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: