检验错误没有返回

来源:6-11 买家订单-api_B

战神40

2020-03-15

"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的显示

写回答

1回答

廖师兄

2020-03-15

【没有返回message的显示】

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

0
3
廖师兄
回复
战神40
Column 'buyer_address' cannot be null. 在实体类上加上@DynamicInsert和@DynamicUpdate
2020-03-18
共3条回复

Spring Boot双版本(1.5/2.1) 打造企业级微信点餐系统

从0到1开发中小型企业级Java应用,并学会迭代重构技巧

6410 学习 · 5247 问题

查看课程