NutzCN Logo
问答 insert问题,求解
发布于 215天前 作者 苍蓝猛兽 166 次浏览 复制 上一个帖子 下一个帖子
标签:

日志

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和空字符串)

1 回复
@Id(auto=false)
添加回复
请先登陆
回到顶部