Bonjour;
j'ai créé 2 entité chapiter et programme, et j'arrive pa a faire le teste par postman pour l'insertion"post" , e, faite l'entité chapiter :
et l'entité Programme est comme suiteCode:
1
2
3
4
5
6
7
8
9
10
11
12 @Entity @Table(name="Chapiter") public class Chapiter{ @Id @GeneratedValue private Integer Id ; private String section; private String[] soustitre; @ManyToOne private Formation formation; //getter & setter }
l'exécution de l'application spring boot a été fait convenablement sans erreurs, cependant lors de l'envoie de requête http par postman j'ai l'erreur suivante :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 @Entity @Table(name ="Formation") public class Formation { @Id @GeneratedValue private Integer id; private String theme; private String categorie; @Temporal(TemporalType.DATE) private Date datelancement; private Integer duree; private String description; @OneToMany(mappedBy="formation") private List<Chapiter> programmes = new ArrayList<>(); private String region; private Boolean presence; private String image; //getter & setter }
le document =Citation:
2021-03-26 19:35:34.295 ERROR 13208 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaObjectRetrievalFailureException: Unable to find com.todo.waycenter.tasks.model.Programme with id 22; nested exception is javax.persistence.EntityNotFoundException: Unable to find com.todo.waycenter.tasks.model.Programme with id 22] with root cause
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13 {"id":325,"theme":"Dev","categorie":"Java","datelancement":"2021-05-25","duree":50, "description":"Spring Security est un Framework de sécurité léger ", "programmes":[ {"id":22,"section":"Introduction Spring Security","soustitre":["Rappels des notions O.O","Découverte de lunivers JEE & JS","Ecosystème FullStack"],"formation_id":325}, {"id":72,"section":"ORM : Notions avancées","soustitre":["Associations : One To Many, Many To Many, ...","JPQL, SQL Native et Named Methods","Fetch Type","Transactions"],"formation_id":325}, {"id":52,"section":"Rest API","soustitre":["Request Mapping","Request Body, Request Param et Path Variable","Response Entity","Jackson & Infinite Loop resolution"],"formation_id":325} ], "region":"Bizerte", "presence":false, "image":"../assets/images/spsec.png" }