报错日志如下,我数了一下字段数是对的。
org.nutz.dao.DaoException: !Nutz SQL Error: 'INSERT INTO t_alarm(alarmType,alarmTime,alarmAddress,did,uid,voiceStatus,noticeStatus,wxNoticeStatus) VALUES(5,1522312692,'{
2018-03-29 16:39:34: "latitude": 29.668904,
2018-03-29 16:39:34: "longitude": 90.954996
2018-03-29 16:39:34:}','868120166601366',3894,0,0,0) '
2018-03-29 16:39:34:PreparedStatement:
2018-03-29 16:39:34:'INSERT INTO t_alarm(alarmType,alarmTime,alarmAddress,did,uid,voiceStatus,noticeStatus,wxNoticeStatus) VALUES(?,?,?,?,?,?,?,?) '
2018-03-29 16:39:34:CaseMessage=Column count doesn't match value count at row 1
2018-03-29 16:39:34: at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104)
2018-03-29 16:39:34: at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
2018-03-29 16:39:34: at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
2018-03-29 16:39:34: at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
2018-03-29 16:39:34: at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
2018-03-29 16:39:34: at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
2018-03-29 16:39:34: at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:125)
2018-03-29 16:39:34: at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92)
2018-03-29 16:39:34: at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
2018-03-29 16:39:34: at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:245)
2018-03-29 16:39:34: at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:257)
2018-03-29 16:39:34: at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
2018-03-29 16:39:34: at org.nutz.dao.impl.NutDao.insert(NutDao.java:105)
2018-03-29 16:39:34: at org.nutz.service.EntityService._insert(EntityService.java:351)
2018-03-29 16:39:34: at cn.xhbds.service.AlarmServiceImpl.insertAlarmInfo(AlarmServiceImpl.java:95)
2018-03-29 16:39:34: at cn.xhbds.service.alarm.DeviceAlarmHandler.saveAlarmIntoDatabase(DeviceAlarmHandler.java:116)
2018-03-29 16:39:34: at cn.xhbds.service.redis.RedisPubSub.dealWithAlarm(RedisPubSub.java:167)
2018-03-29 16:39:34: at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626)
2018-03-29 16:39:34: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
2018-03-29 16:39:34: at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:569)
2018-03-29 16:39:34: at com.mysql.cj.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1826)
2018-03-29 16:39:34: at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
pojo代码如下:
package cn.xhbds.entity;
import java.io.Serializable;
import org.nutz.dao.entity.annotation.*;
/**
* 报警消息
* @author admin
*
*/
@Table("t_alarm")
public class AlarmInfo implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
//报警消息ID
@Id
@Column("alarmid")
private int alarmId;
//报警类型
@Column("alarmType")
private long alarmType;
//报警时间
@Column("alarmTime")
private long alarmTime;
//报警位置
@Column("alarmAddress")
@ColDefine(width=200)
private String alarmAddress;
@Column("did")
@ColDefine(width=32)
private String dId;
@Column("uid")
private int uId;
@Column
@Comment("电话报警推送状态")
private int voiceStatus;
@Column
@Comment("报警通知推送的状态")
private int noticeStatus;
@Column
@Comment("微信报警的状态")
private int wxNoticeStatus;
/*@One(field = "dId",target=Device.class)
private Device device;*/
public AlarmInfo() {
super();
}
public AlarmInfo(long alarmType, long alarmTime, String alarmAddress, String dId, int uId ,
int voiceStatus , int noticeStatus , int wxNoticeStatus) {
super();
this.alarmType = alarmType;
this.alarmTime = alarmTime;
this.alarmAddress = alarmAddress;
this.dId = dId;
this.uId = uId;
this.voiceStatus = voiceStatus;
this.noticeStatus = noticeStatus;
this.wxNoticeStatus = wxNoticeStatus;
}
public int getAlarmId() {
return alarmId;
}
public AlarmInfo setAlarmId(int alarmId) {
this.alarmId = alarmId;
return this;
}
public long getAlarmType() {
return alarmType;
}
public AlarmInfo setAlarmType(long alarmType) {
this.alarmType = alarmType;
return this;
}
public String getAlarmAddress() {
return alarmAddress;
}
public AlarmInfo setAlarmAddress(String alarmAddress) {
this.alarmAddress = alarmAddress;
return this;
}
public long getAlarmTime() {
return alarmTime;
}
public AlarmInfo setAlarmTime(long alarmTime) {
this.alarmTime = alarmTime;
return this;
}
public String getdId() {
return dId;
}
public AlarmInfo setdId(String dId) {
this.dId = dId;
return this;
}
public int getuId() {
return uId;
}
public AlarmInfo setuId(int uId) {
this.uId = uId;
return this;
}
public Integer getVoiceStatus() {
return voiceStatus;
}
public AlarmInfo setVoiceStatus(Integer voiceStatus) {
this.voiceStatus = voiceStatus;
return this;
}
public int getNoticeStatus() {
return noticeStatus;
}
public AlarmInfo setNoticeStatus(int noticeStatus) {
this.noticeStatus = noticeStatus;
return this;
}
public int getWxNoticeStatus() {
return wxNoticeStatus;
}
public AlarmInfo setWxNoticeStatus(int wxNoticeStatus) {
this.wxNoticeStatus = wxNoticeStatus;
return this;
}
}
插入部分代码如下:
@Override
public AlarmInfo insertAlarmInfo(AlarmInfo alarmInfo) {
return this._insert(alarmInfo);
}