NutzCN Logo
问答 nutZdao爆错...
发布于 2729天前 作者 蛋蛋的忧伤 1599 次浏览 复制 上一个帖子 下一个帖子
标签:

代码为:

public Object add(@Param("..") Prize prize) throws AlertException{
		prizeDao.fastInsert(prize);
		return Outs.ok("添加成功", null);
	}

报错信息为:

[DEBUG] 19:15:26.537 me.zouooh.mvc.LogTimeProcessor.process(LogTimeProcessor.java:27) - [POST] /admin/prize/add 10209ms
[WARN ] 19:15:26.538 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/prize/add :
org.nutz.dao.DaoException: !Nutz SQL Error: 'INSERT INTO prize(name,probability,total_number,img,descr,prolevel) VALUES(?,?,?,?,?,?) 
    | 1 |   2 |  3 |   4 |   5 |  6 |
    |---|-----|----|-----|-----|----|
    | 2 | 2.0 | 22 | 222 | 222 | 22 |
  For example:> "INSERT INTO prize(name,probability,total_number,img,descr,prolevel) VALUES('2',2.0,22,'222','222','22') "'
PreparedStatement: 
'INSERT INTO prize(name,probability,total_number,img,descr,prolevel) VALUES(?,?,?,?,?,?) '
CaseMessage=Unknown column 'descr' in 'field list'
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:96)
	at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:187)
	at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:334)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:59)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:257)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:289)
	at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
	at org.nutz.dao.impl.NutDao.fastInsert(NutDao.java:202)
	at me.zouooh.module.dao.IdEntityDao.fastInsert(IdEntityDao.java:47)
	at com.yixin.oa.admin.controller.PrizeController.add(PrizeController.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at me.zouooh.mvc.shiro.NutShiroProcessor.process(NutShiroProcessor.java:62)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.yixin.oa.admin.mvc.VmcProcessor.process(VmcProcessor.java:54)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at me.zouooh.mvc.LogTimeProcessor.process(LogTimeProcessor.java:22)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
	at me.zouooh.mvc.BurroFilter.doFilter(BurroFilter.java:38)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'descr' in 'field list'
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
	at com.mysql.jdbc.Util.getInstance(Util.java:387)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
	at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
	at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:131)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:268)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:82)
	... 70 more

我拿着sql到sqlyog里执行是没问题的,不知道哪里问题...
2 回复

pojo

package com.yixin.oa.module.oa.entity;

import java.io.Serializable;

import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Table;

/**
 * 奖品实体
 * @author wangqinghua
 *
 */
@Table("prize")
@Comment("奖品")
public class Prize implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	public static final String TABLE_NAME = "prize";
	
	/**
 	 * id
 	 */
    public static final String ID = "id";
	/**
 	 * 奖品名
 	 */
    public static final String NAME = "name";
	/**
 	 * 中奖概率
 	 */
    public static final String PROBABILITY = "probability";
	/**
 	 * 奖品总数
 	 */
    public static final String TOTAL_NUMBER = "total_number";
	/**
 	 * 奖品图片
 	 */
    public static final String IMG = "img";
	/**
 	 * 描述
 	 */
    public static final String DESCR = "descr";
	/**
 	 * 等级
 	 */
    public static final String PROLEVEL = "prolevel";
	
	@Id
	@Comment("id")
	@ColDefine(type = ColType.INT,width = 8,notNull = true)
    private Integer id;
    
	@Column
	@Comment("奖品名")
	@ColDefine(type = ColType.VARCHAR,width = 20)
    private String name;
    
	@Column
	@Comment("中奖概率")
	@ColDefine(type = ColType.FLOAT,width = 22)
    private Double probability;
    
	@Column
	@Comment("奖品总数")
	@ColDefine(type = ColType.INT,width = 8)
    private Integer total_number;
    
	@Column
	@Comment("奖品图片")
	@ColDefine(type = ColType.VARCHAR,width = 100)
    private String img;
    
	@Column
	@Comment("描述")
	@ColDefine(type = ColType.VARCHAR,width = 30)
    private String descr;
    
	@Column
	@Comment("等级")
	@ColDefine(type = ColType.VARCHAR,width = 30)
    private String prolevel;
    
	
    public void setId (Integer id){
    	this.id = id;
    }
    
	/**
 	 * id
 	 */
    public Integer  getId(){
    	return this.id;
    }
    
    public void setName (String name){
    	this.name = name;
    }
    
	/**
 	 * 奖品名
 	 */
    public String  getName(){
    	return this.name;
    }
    
    public void setProbability (Double probability){
    	this.probability = probability;
    }
    
	/**
 	 * 中奖概率
 	 */
    public Double  getProbability(){
    	return this.probability;
    }
    
    public void setTotal_number (Integer total_number){
    	this.total_number = total_number;
    }
    
	/**
 	 * 奖品总数
 	 */
    public Integer  getTotal_number(){
    	return this.total_number;
    }
    
    public void setImg (String img){
    	this.img = img;
    }
    
	/**
 	 * 奖品图片
 	 */
    public String  getImg(){
    	return this.img;
    }
    
    public void setDescr (String descr){
    	this.descr = descr;
    }
    
	/**
 	 * 描述
 	 */
    public String  getDescr(){
    	return this.descr;
    }
    
    public void setProlevel (String prolevel){
    	this.prolevel = prolevel;
    }
    
	/**
 	 * 等级
 	 */
    public String  getProlevel(){
    	return this.prolevel;
    }
    
}

很明显,表没有descr字段

添加回复
请先登陆
回到顶部