Convertir mon Class avec des attributs many to one et one to many to json
je veut ecrire cette class en json pour tester un web service voici les attributs de mon class, quoi faire avec les attributs many TO One et One To Many
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
@Id
private int id;
private String civiliteDest;
private int cpDest;
@Temporal(TemporalType.DATE)
private Date dateCreation;
private String delegationDest;
private String description;
private String emailDest;
private String nomDest;
private String nomRueDest;
private int numMaisonDest;
private String paysDest;
private String prenomDest;
private String raisonSocial;
private int tarif;
private int telDest;
private String typeContenu;
private String villeDest;
//bi-directional many-to-one association to Abonne
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="Abonne")
@JsonBackReference
private Abonne abonneBean;
//bi-directional many-to-one association to Poid
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="intervallePoids")
@JsonBackReference
private Poid poid;
//bi-directional many-to-one association to Service
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="Service")
@JsonBackReference
private Service serviceBean;
//bi-directional many-to-one association to Agence
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="AgenceDepot")
@JsonBackReference
private Agence agence;
//bi-directional many-to-one association to Evennement
@OneToMany(mappedBy="envoi",cascade = { CascadeType.ALL,CascadeType.PERSIST,CascadeType.MERGE },fetch = FetchType.EAGER)
@JsonManagedReference
private List<Evennement> evennements; |