日志
2017-12-18 13:23:11.588 ERROR 14964 --- [nio-8081-exec-9] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.nutz.dao.DaoException: !Nutz SQL Error: 'INSERT INTO t_business_order(bdate,user,spoint,epoint) VALUES('2017-12-18','admin','2','3') '
PreparedStatement:
'INSERT INTO t_business_order(bdate,user,spoint,epoint) VALUES(?,?,?,?) '
CaseMessage=Field 'id' doesn't have a default value] with root cause
java.sql.SQLException: Field 'id' doesn't have a default value
Order.class
@Table("t_business_order")
public class Order {
@Id
@Column
private Long id;
用处
dao.insert(order, true, false, true);
debug调试后order对象中id有值
问题 为什么判定id没有值,导致拼接sql时没有加上id(这边忽略NULL和空字符串)