NutzCN Logo
问答 nutzwk修改数据异常
发布于 2973天前 作者 Hamming 1696 次浏览 复制 上一个帖子 下一个帖子
标签:

修改数据 报错

2016-09-26 10:16:51,591 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - UPDATE app_address SET add_user_id=?,name=?,phone=?,address_detail=?,postal_code=?,def=?,opAt=?  WHERE address_id=?
    | 1 |   2 |          3 |            4 |       5 |    6 |          7 | 8 |
    |---|-----|------------|--------------|---------|------|------------|---|
    | 1 | hhh | 1123456879 | 上海市浦东新区金桥why | 2222222 | true | 1474856153 | 2 |
  For example:> "UPDATE app_address SET add_user_id=1,name='hhh',phone='1123456879',address_detail='上海市浦东新区金桥why',postal_code=2222222,def=true,opAt=1474856153  WHERE address_id=2"
2016-09-26 10:17:00,058 nuoshang.bluejay.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) DEBUG - [POST]URI=/private/app/app_addresses/editDo 66928ms
2016-09-26 10:17:00,058 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN  - Error@/private/app/app_addresses/editDo :
org.nutz.lang.FailToGetValueException: Fail to get value for [nuoshang.bluejay.modules.app.models.App_address]->[id]
	at org.nutz.lang.Mirror.makeGetValueException(Mirror.java:763)
	at org.nutz.lang.Mirror.getValue(Mirror.java:826)
	at org.nutz.el.opt.object.AccessOpt.calculate(AccessOpt.java:46)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:55)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:38)
	at org.nutz.el.El.eval(El.java:30)
	at nuoshang.bluejay.common.services.log.SysLogAopInterceptor.doLog(SysLogAopInterceptor.java:78)
	at nuoshang.bluejay.common.services.log.SysLogAopInterceptor.filter(SysLogAopInterceptor.java:62)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at nuoshang.bluejay.modules.app.controllers.AppAddressController$$NUTZAOP.editDo(AppAddressController.java:1)
	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 nuoshang.bluejay.common.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:35)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at nuoshang.bluejay.common.processor.NutShiroProcessor.process(NutShiroProcessor.java:52)
	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 nuoshang.bluejay.common.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:36)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at nuoshang.bluejay.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:21)
	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.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at nuoshang.bluejay.common.filter.RouteFilter.doFilter(RouteFilter.java:33)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	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.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at org.eclipse.jetty.server.Server.handle(Server.java:499)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodException: Fail to find getter for [nuoshang.bluejay.modules.app.models.App_address]->[id]
	at sun.reflect.GeneratedConstructorAccessor64.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:17)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.lang.Lang.makeThrow(Lang.java:150)
	at org.nutz.lang.Mirror.getGetter(Mirror.java:251)
	at org.nutz.lang.Mirror.getGetter(Mirror.java:197)
	at org.nutz.lang.Mirror.getValue(Mirror.java:804)
	... 70 more

修改收货地址 代码如下

    @At
    @Ok("json")
    @SLog(tag = "修改App_address", msg = "ID:${args[0].id}")
    public Object editDo(@Param("..") App_address appAddress, HttpServletRequest req) {
		try {

			appAddress.setOpAt((int) (System.currentTimeMillis() / 1000));
			appAddressService.updateIgnoreNull(appAddress);
			return Result.success("system.success");
		} catch (Exception e) {
			return Result.error("system.error");
		}
    }
4 回复

实体类

package nuoshang.bluejay.modules.app.models;

import nuoshang.bluejay.common.base.Model;
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;

import java.io.Serializable;
/**
 * 通过 DBCodeCreateTool 代码自动生成
 * @author
 * @time 2016-08-12 09:51:27
 */
@Table("app_address")
public class App_address extends Model implements Serializable{
    private static final long serialVersionUID = 1L;
    /********** attribute ***********/
    /****地址编号 ****/
    @Id
    @Comment("地址编号ID")
    @Column("address_id")
    private Long address_id;

    /****用户编号 ****/
    @Comment("用户编号")
    @Column("add_user_id")
    private Long add_user_id;

    @Comment("用户名")
    @Column("name")
    private String name;

    /****联系电话 ****/
    @Comment("联系电话")
    @Column("phone")
    private String phone;

    /****地址信息 ****/
    @Comment("地址信息")
    @Column("address_detail")
    private String address_detail;

    /****邮政编码 ****/
    @Comment("邮政编码")
    @Column("postal_code")
    private int postal_code;

    //默认
    @Comment("默认收货地址")
    @Column("def")
    private boolean def;

    public App_address() {}

    public Long getAddress_id() {
        return address_id;
    }

    public void setAddress_id(Long address_id) {
        this.address_id = address_id;
    }

    /********** get/set ***********/

    public Long getAdd_user_id() {
        return add_user_id;
    }
    public void setAdd_user_id(Long add_user_id) {
        this.add_user_id = add_user_id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getAddress_detail() {
        return address_detail;
    }
    public void setAddress_detail(String address_detail) {
        this.address_detail = address_detail;
    }
    public int getPostal_code() {
        return postal_code;
    }
    public void setPostal_code(int postal_code) {
        this.postal_code = postal_code;
    }

    public boolean isDef() {
        return def;
    }

    public void setDef(boolean def) {
        this.def = def;
    }
}

@SLog写错了,你的实体类没有id,但msg里面取的是id

来自炫酷的 NutzCN

@wendal 恩 谢谢 一直不是很明白 @SLog是页面传消息用的么

@SLog 是 系统管理--日志管理 里的内容,不是重要的业务操作没必要写数据。

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