Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3303

@BsonProperty on a getter is ignored if the field is not serialized anyway

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.10.2
    • Component/s: POJO
    • Labels:
      None

      If I have a getter/setter pair like
      public long get07()
      and
      public void set07(long _07)
      I don't see any way to make these serialize and deserialize using the POJO support.
      Adding @BsonProperty("07") has no effect at all and the field is simply ignored completely.
      The only way I found was to add another pair of getter/setter that has some name that is recognized as property and then use the annotation to configure the name.

      Imho adding the annotation to a paramterless getter should be enough to make it serialize.

            Assignee:
            Unassigned Unassigned
            Reporter:
            vampire Björn Kautler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: