How to write a modal with a nested array in spring? : I am writing a new class in spring boot where I need to write a modal class in which there will be a sub modal classes(I mean an array with a nested arrays), but when I try to run it I am getting the sub modal class names as attributes not the real attributes which I mentioned in sub modals.

    

**********ChangeBin Modal***********


    package com.demo.model;

    import java.io.Serializable;
    import java.util.List;

    import org.springframework.data.mongodb.core.mapping.Field;

    public class Changebin implements Serializable{

    @Field(value = "Change_bin_Past")
    private ChangebinPast changebinpast;

    @Field(value = "Change_bin_Present")
    private ChangebinPresent changebinpresent;

    public ChangebinPast getChangebinpast() {
    return changebinpast;
    }

    public void setChangebinpast(ChangebinPast changebinpast) {
    this.changebinpast = changebinpast;
    }

    public ChangebinPresent getChangebinpresent() {
    return changebinpresent;
    }

    public void setChangebinpresent(ChangebinPresent changebinpresent) 
    {
    this.changebinpresent = changebinpresent;
    }

    }




***********ChangebinPast -- Sub modal ******************

    package com.demo.model;

    import java.io.Serializable;

    import org.springframework.data.mongodb.core.mapping.Field;

    public class ChangebinPast implements Serializable {

    @Field(value = "ID_A")
    private String ID_A;

    public String getID_A() {
    return ID_A;
    }

    public void setID_A(String ID_A) {
    this.ID_A = ID_A;
    }

    public String getID_B() {
    return ID_B;
    }

    public void setID_B(String ID_B) {
    this.ID_B = ID_B;
    }

    @Field(value = "ID_B")
    private String ID_B;
    }

***************Changebinpresent -- Sub Modal***************



    package com.demo.model;

    import java.io.Serializable;

    import org.springframework.data.mongodb.core.mapping.Field;

    public class ChangebinPresent implements Serializable {
 
    @Field(value = "ID_A1")
    private String ID_A1;

    @Field(value = "ID_B1")
    private String ID_B1;

    public String getID_A1() {
    return ID_A1;
    }

    public void setID_A1(String ID_A1) {
    this.ID_A1 = ID_A1;
    }

    public String getID_B1() {
    return ID_B1;
    }

    public void setID_B1(String ID_B1) {
    this.ID_B1 = ID_B1;
    }
    }

Expected : 

ChangeBin [
   {
      ID_A : "",
      ID_B : ""
   },
   {
     ID_A1:  "",
     ID_B1: ""
   }
]


But got like this :

ChangeBin [
   {
      changebinpast: "",
       changebinpresent : ""
   },
   {
     changebinpast:  "",
     changebinpresent : ""
   }
]