JSON解析错误:已经有id的POJO(java.lang.Long)

时间:2018-06-11 23:15:27

标签: angular spring-boot jpa jackson

我在两个实体Equipement和DemandeDI之间有一个双向关系,我想在DemandeDI中添加一个带有休息服务的行(Angular 5),但我发生了这个错误
请注意,当我手动添加存储库或行时,问题不会出现 使用RestController类的高级rest客户端。

设备实体

   @JsonIdentityInfo(generator = 
   ObjectIdGenerators.PropertyGenerator.class,property = "id" ,
    scope = Equipement.class)

 @Entity
 public class Equipement implements Serializable {

@Id
@GeneratedValue
private Long id;

 @Column(unique=true,nullable = false)
private String reference;

@OneToMany( mappedBy = "equipement" , cascade = CascadeType.REMOVE)
private Collection<DemandeDI> demandeDIS;
}

DemandeDI实体

@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,property = "id",
    scope = DemandeDI.class)
@Entity
public class DemandeDI implements Serializable {


@Id
@GeneratedValue
private Long id;

@Column(nullable = false)
private String description;

@CreatedDate
@Temporal(TIMESTAMP)
private Date dateDI;

private String etat;

@ManyToOne
@JoinColumn(name = "equipement")
private Equipement equipement;

}

我总是捕捉错误并在swal窗口中显示它们 here is the message error

0 个答案:

没有答案