NutzCN Logo
问答 使用nutz写一个简单的更新数据库操作demo报错
发布于 2811天前 作者 qq_06bc130b 2085 次浏览 复制 上一个帖子 下一个帖子
标签:

17-3-6 9:9:40.3 DEBUG [http-apr-8080-exec-5] Found mapping for [GET] path=/user/update : UserModule.update(UserModule.java:69)
17-3-6 9:9:40.5 DEBUG [http-apr-8080-exec-5] Get 'userModule'<class com.askj.nutzbook.module.UserModule>
17-03-06 09:09:40.010 WARN [http-apr-8080-exec-5] Error@/user/update :
java.lang.RuntimeException: Don't know how to make fetch key com.askj.nutzbook.bean.User:'com.askj.nutzbook.bean.User@43059849'
at org.nutz.lang.Lang.makeThrow(Lang.java:132)
at org.nutz.dao.util.Pojos$Items.cndAuto(Pojos.java:149)
at org.nutz.dao.impl.EntityOperator$1.invoke(EntityOperator.java:98)
at org.nutz.lang.Lang.each(Lang.java:1600)
at org.nutz.lang.Lang.each(Lang.java:1509)
at org.nutz.dao.impl.EntityOperator.addUpdateForIgnoreNull(EntityOperator.java:95)
at org.nutz.dao.impl.NutDao.updateIgnoreNull(NutDao.java:291)
at com.askj.nutzbook.module.UserModule.update(UserModule.java:73)
at com.askj.nutzbook.module.UserModule$$FASTCLASS._invoke(UserModule.java:1)
at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
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 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.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 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
7 回复

贴User类和UserModule的代码, 按"插入代码或日志片段" 按钮啊

 /**
     * 更新方法
     */
    @At
    public Object update(@Param("..")User user){
    	NutMap re=new NutMap();
    	user.setCreateTime(null);
    	user.setName(null);
    	user.setUpdateTime(new Date());
    	dao.updateIgnoreNull(user);
    	return re.setv("ok",true);
    }
17-3-6 9:9:40.3 DEBUG [http-apr-8080-exec-5] Found mapping for [GET] path=/user/update : UserModule.update(UserModule.java:69)
17-3-6 9:9:40.5 DEBUG [http-apr-8080-exec-5] Get 'userModule'<class com.askj.nutzbook.module.UserModule>
17-03-06 09:09:40.010 WARN [http-apr-8080-exec-5] Error@/user/update :
java.lang.RuntimeException: Don't know how to make fetch key com.askj.nutzbook.bean.User:'com.askj.nutzbook.bean.User@43059849'
	at org.nutz.lang.Lang.makeThrow(Lang.java:132)
	at org.nutz.dao.util.Pojos$Items.cndAuto(Pojos.java:149)
	at org.nutz.dao.impl.EntityOperator$1.invoke(EntityOperator.java:98)
	at org.nutz.lang.Lang.each(Lang.java:1600)
	at org.nutz.lang.Lang.each(Lang.java:1509)
	at org.nutz.dao.impl.EntityOperator.addUpdateForIgnoreNull(EntityOperator.java:95)
	at org.nutz.dao.impl.NutDao.updateIgnoreNull(NutDao.java:291)
	at com.askj.nutzbook.module.UserModule.update(UserModule.java:73)
	at com.askj.nutzbook.module.UserModule$$FASTCLASS._invoke(UserModule.java:1)
	at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
	at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
	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 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.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 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
17-3-6 9:21:16.762 DEBUG [http-apr-8080-exec-8] Found mapping for [GET] path=/user/update : UserModule.update(UserModule.java:69)
17-3-6 9:21:16.763 DEBUG [http-apr-8080-exec-8] Get 'userModule'<class com.askj.nutzbook.module.UserModule>
17-03-06 09:21:16.764 WARN [http-apr-8080-exec-8] Error@/user/update :
java.lang.RuntimeException: Don't know how to make fetch key com.askj.nutzbook.bean.User:'com.askj.nutzbook.bean.User@5954100e'
	at org.nutz.lang.Lang.makeThrow(Lang.java:132)
	at org.nutz.dao.util.Pojos$Items.cndAuto(Pojos.java:149)
	at org.nutz.dao.impl.EntityOperator$1.invoke(EntityOperator.java:98)
	at org.nutz.lang.Lang.each(Lang.java:1600)
	at org.nutz.lang.Lang.each(Lang.java:1509)
	at org.nutz.dao.impl.EntityOperator.addUpdateForIgnoreNull(EntityOperator.java:95)

	at org.nutz.dao.impl.NutDao.updateIgnoreNull(NutDao.java:291)
	at com.askj.nutzbook.module.UserModule.update(UserModule.java:73)
	at com.askj.nutzbook.module.UserModule$$FASTCLASS._invoke(UserModule.java:1)
	at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
	at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
	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 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.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 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

package com.askj.nutzbook.bean;

import java.util.Date;

public class User {
private int id;
private String name;
private String password;
private String salt;
private Date createTime;
private Date updateTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}

public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}
public String getSalt() {
    return salt;
}
public void setSalt(String salt) {
    this.salt = salt;
}
public Date getCreateTime() {
    return createTime;
}
public void setCreateTime(Date createTime) {
    this.createTime = createTime;
}
public Date getUpdateTime() {
    return updateTime;
}
public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime;
}

}

改成

@Table("t_user")
public class User {
 @Id
 private int id;
 @Name
 private String name;
 private String password;
 private String salt;
 private Date createTime;
 private Date updateTime;

PS: 为啥一个注解都没有呢???

好了 非常感谢

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