title: I can not add an object from the web application but however it works fine with postman
body: <p>I'm trying to add "a group", I'm using a rest service. I can't understand why I'm getting a http 400 error while the same service works fine with Postman. </p>
  
  <p>here's my code in JEE </p>
  
  <p>Groupe.java </p>
  
  <pre><code>@Entity
  @Table(name = "groupes")
  public class Groupe implements Serializable {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long idgrp;
  
  
  
      @NotNull
     // @Lob
      private String nom_groupe;
  
  
      @ManyToOne(optional = false)
      @JoinColumn
      @OnDelete(action = OnDeleteAction.CASCADE)
      @JsonIgnore
      private EntityType entityType;
  
      public Long getIdgrp() {
          return idgrp;
      }
  
      public void setIdgrp(Long idgrp) {
          this.idgrp = idgrp;
      }
  
      public String getNom_groupe() {
          return nom_groupe;
      }
  
      public void setNom_groupe(String nom_groupe) {
          this.nom_groupe = nom_groupe;
      }
  
      public EntityType getEntityType() {
          return entityType;
      }
  
      public void setEntityType(EntityType entityType) {
          this.entityType = entityType;
      }
  
  
  
  }
  </code></pre>
  
  <p>My RestService </p>
  
  <pre><code>  @PostMapping("/entityTypes/{id_type}/groups")
      public Groupe createGroupe(@PathVariable (value = "id_type") Long id_type,
                                   @Valid @RequestBody Groupe groupe) {
          return entityTypeRepository.findById(id_type).map(entityType -&gt; {
              groupe.setEntityType(entityType);
              return groupeRepository.save(groupe);
          }).orElseThrow(() -&gt; new ResourceNotFoundException("id_type " + id_type + " not found", null, groupe));
      }
  </code></pre>
  
  <p>For now I'm not having any problem, when I try to add a group using Postman it works just fine. My problem is when I use Angular </p>
  
  <pre><code> onSubmit() {
  this.grpInfo = new GroupeInfo(
        this.form.nom_groupe
      );
     headers.append('Authorization', window.localStorage.getItem('token'));
      this.http
        .post&lt;any&gt;('http://localhost:8080/entityTypes/' + this.route.snapshot.params['id'] + '/groups', { headers })
        .subscribe(
          (response) =&gt; {
           // console.log(response.content);
            response.content.nom_groupe = this.grpInfo.nom_groupe;
            //console.log(response);
          },
          (error) =&gt; {
            console.log(error);
          }
        );
   }
  </code></pre>
  
  <p>This is when I get a http 400 error and this error in the backend </p>
  
  <pre><code>[nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.bind.MethodArgumentNotValidException: Validation failed for argument [1] in public com.hraccess.openhr.myEntities.Groupe com.hraccess.openhr.myController.GroupeController.createGroupe(java.lang.Long,com.hraccess.openhr.myEntities.Groupe): [Field error in object 'groupe' on field 'nom_groupe': rejected value [null]; codes [NotNull.groupe.nom_groupe,NotNull.nom_groupe,NotNull.java.lang.String,NotNull]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [groupe.nom_groupe,nom_groupe]; arguments []; default message [nom_groupe]]; default message [ne peut pas être nul]] ]
  </code></pre>