Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-697

Field-local generics information not honored

    XMLWordPrintable

    Details

    • Sprint:
      57 - Fowler Aftermath

      Description

      In my project, we have an entity called NormalizedProfile, which is a huge collection of generic ListField s. Each listField is a list of Value s plus some metadata. And Value is a (well) single "value" plus some metadata. In our case, atomic "value" is either primitive wrapper, Object or Enum, never a collection (in case it is relevant).

      Value<T> gets its generic type from ListField<T> it is enclosed in. Nothing fancy.

      In addition to standard java SpringDataMongo config, we customise MappingMongoConverter to stop save and use "_class" field. No polymorphic behaviour is needed in our case, so why not.

      Problem is with Object- and Enum- generalized ListField s. After they are saved, they never read as a real object and returned as LHM instead. When I use java.util.List instead of our custom structure, everything works fine.

      Please see attached minimal test - j.u.List<Education> testcase succeeds and ListField<Education> fails.

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            malexejev Max Alexejev
            Last updater:
            Oliver Drotbohm
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: