Home JSON parse error: Already had POJO for id (java.lang.Long)
Reply: 0

JSON parse error: Already had POJO for id (java.lang.Long)

user1378
1#
user1378 Published in June 18, 2018, 1:07 pm

I have a bidirectional relationship between two entities Equipement and DemandeDI and i want to add a row in DemandeDI with rest service ( Angular 5 ) but i have occured this error
Note that the problem doesn't appear when i add manually a row with repository or advanced rest client using RestController class.

Equipement Entity

   @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 Entity

@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;

}

I am always catching errors and displaying them in swal window
here is the message error

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.346105 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO