title: How to map an entity as java.util.Map with spring Data JPA?
body: <p>I have such entities:</p>
  
  <p>Bonus_Request entity:</p>
  
  <pre><code>@Entity
  @Table(name = "bonus_request")
  public class BonusRequest {
  
      //some code above...
  
      @OneToMany(fetch = FetchType.EAGER, mappedBy = "bonusRequest")
      @JsonManagedReference(value = "parameter-bonus_request")
      private Set&lt;BonusRequestParameter&gt; parameters;
  }
  </code></pre>
  
  <p>Bonus_Request_Parameter entity:</p>
  
  <pre><code>@Entity
  @Table(name = "bonus_request_parameter")
  public class BonusRequestParameter {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
  
      @Size(max = 30)
      @Column(name = "parameter", nullable = false)
      private String parameter;
  
      @Size(max = 50)
      @Column(name = "value", nullable = false)
      private String value;
  
      @JoinColumn(name = "bonus_request_id", nullable = false)
      @ManyToOne(fetch = FetchType.LAZY)
      @JsonBackReference(value = "parameter-bonus_request")
      private BonusRequest bonusRequest;
  
  }
  </code></pre>
  
  <p>I wonder if it is possible to map the BonusRequestParameter entity as a java.util.Map field in the BonusRequest entity.</p>
  
  <p>For example:</p>
  
  <pre><code>@Entity
  @Table(name = "bonus_request")
  public class BonusRequest {
  
      @OneToMany(fetch = FetchType.EAGER, mappedBy = "bonusRequest")
      private Map&lt;String, String&gt; parameters; //String parameter, String value
  }
  </code></pre>
  
  <p>I use:</p>
  
  <ol>
  <li>Spring Data JPA - 2.1.7</li>
  <li>PostgreSQL DB - 10.7</li>
  </ol>