rest - JHipster POST entity ID -
i'm trying post following object via json through jhipster api:
{ "avaliacao": 3, "datahoracancelamento": "2017-08-18t18:15:39.380z", "datahoraentrega": "2017-08-18t18:15:39.380z", "datahorapedido": "2017-08-18t18:15:39.380z", "datahoraprevisao": "2017-08-18t18:15:39.380z", "datahorapronto": "2017-08-18t18:15:39.380z", "numero": "string", "observacoescliente": "string", "observacoesrestaurante": "string", "restauranteid": 1051, "shoppingid": 1151, "status": "em_criacao", "tempopreparacao": 6, "total": 4 } but manage save application form on frontend. when try post via curl or postman
500 internal server error with following stacktrace on backend:
exception in br.com.myapp.web.rest.pedidoresource.createpedido() cause = 'org.hibernate.exception.constraintviolationexception: not execute statement' , exception = 'could not execute statement; sql [n/a]; constraint ["fk_pedido_restaurante_id: public.pedido foreign key(restaurante_id) references public.restaurante(id) (1051)"; sql statement [23506-195]]; nested exception org.hibernate.exception.constraintviolationexception: not execute statement p.s.: acknowledge error references 2 entity fields ("restauranteid" , "shoppingid") have on payload, indeed if post object without these fields works.
according error message means json object posting missing information regard entities referenced. proper json object have @ swagger documentation in app or inspect web tools of web browser payload done when making post on browser.
Comments
Post a Comment