插入数据时出现错误409,无法执行语句,它表示字段为空,但字段不为空

时间:2019-07-18 23:09:22

标签: spring rest spring-boot

我尝试使用Advanced Rest Client在我的Rest API中插入一些数据,但是当我发送数据时,我收到一条错误消息,提示字段不能为空,但该字段不为空。所以我想知道为什么收到此消息?

这是我的课程:

@Entity
@Data
@Table(name = "affaire")
public class Affaire implements Serializable {
  private static final long serialVersionUID = 1L;

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "id", insertable = false, nullable = false)
  private Integer id;

  @Column(name = "sn", nullable = false)
  private String sn;



  @Column(name="idAccessoire", insertable = false, nullable = false, updatable = false)
  private Integer idAccessoire;

  @Column(name="idFlux", insertable = false, nullable = false, updatable = false)
  private Integer idFlux;

  @Column(name="idReparation", insertable = false, nullable = false, updatable = false)
  private Integer idReparation;

  @Column(name="idVariante", insertable = false, nullable = false, updatable = false)
  private Integer idVariante;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name="idAccessoire", nullable = false)
  //@JsonManagedReference
  private Accessoire accessoire;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name="idFlux", nullable = false)
  //@JsonManagedReference
  private Flux flux;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name="idReparation", nullable = false)
  //@JsonManagedReference
  private Reparation reparation;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name="idVariante", nullable = false)
  //@JsonManagedReference
  private Variante variante;

  @OneToMany(mappedBy = "affaire", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
  //@JsonBackReference
  @ToString.Exclude
  private List<Affecter> affecters;


}

这是我通过POST方法发送的JSON:

{
  "SN":"4444AAA",
  "ZC":null,
  "certificat":null,
  "etat" : false,
  "fin_eval": "2019-08-25",
  "fin_rep": "2019-09-14",
  "limite_calendaire":"10R28",
  "date_lancement":"2019-07-19",
  "accord_client" : false,
  "id_accessoire" : 1,
  "id_flux": 1,
  "id_reparation": 2,
  "id_variante" : 7,
  "flux_id" : null
}

0 个答案:

没有答案