请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

检验错误没有返回

"message": "could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement",

public static OrderDTO conver(OrderForm orderForm){
Gson gson=new Gson();

    OrderDTO orderDTO=new OrderDTO();
    orderDTO.setBuyerName(orderForm.getName());
    orderDTO.setBuyerPhone(orderForm.getPhone());

// orderDTO.setBuyerAddress(orderForm.getAddress());
orderDTO.setBuyerOpenid(orderForm.getOpenid());
List orderDetailList=new ArrayList<>();
try {
orderDetailList= gson.fromJson(orderForm.getItems(),new TypeToken<List>(){}.getType());
}catch (Exception e){
log.error("[对象转换]错误,string={}",
orderForm.getItems());
throw new SellException(ResultEnum.PARAM_ERROR);
}
orderDTO.setOrderDetailList(orderDetailList);
return orderDTO;
}
注销 orderDTO.setBuyerAddress(orderForm.getAddress()); 这段。
@NotEmpty(message = “地址必填”)
private String address;
没有返回message的显示

正在回答 回答被采纳积分+3

1回答

廖师兄 2020-03-15 23:08:21

【没有返回message的显示】

现状是什么样,控制台报什么错,浏览器的界面显示什么?

0 回复 有任何疑惑可以回复我~
  • 提问者 战神40 #1
    {
        "timestamp": "2020-03-16T01:53:13.507+0000",
        "status": 500,
        "error": "Internal Server Error",
        "message": "could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement",
        "path": "/sell/buyer/order/create"
    }---》返回这个
    回复 有任何疑惑可以回复我~ 2020-03-16 09:53:58
  • 提问者 战神40 #2
    java.sql.SQLIntegrityConstraintViolationException: Column 'buyer_address' cannot be null
    回复 有任何疑惑可以回复我~ 2020-03-16 09:54:35
  • 廖师兄 回复 提问者 战神40 #3
    Column 'buyer_address' cannot be null.  在实体类上加上@DynamicInsert和@DynamicUpdate
    回复 有任何疑惑可以回复我~ 2020-03-18 01:04:44
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信