NutzCN Logo
问答 实体设置@One以后查询报错
发布于 6天前 作者 wx_bo9oii7p4jiduf25sh2a 35 次浏览 复制 上一个帖子 下一个帖子
标签:

在实体类设置了@One, 用sql语句查询报错

 @One(field = "table_id")
    public Sys_tb_language language;
 Sql sql = Sqls.create("select distinct a.* from sys_tb_menu a,sys_tb_role_menu b where a.id=b.menu_id and " +
                "$m and b.role_id=@roleId   order by a.sort ASC,a.create_date asc");
        sql.params().set("roleId", roleId);
        sql.vars().set("m", "a.pid=" + pid);
        List<Sys_tb_menu> sys_tb_menus = sysTenantMenuService.listEntity(sql);

报错日志

15:15:02.513 [DubboServerHandler-192.168.13.246:11292-thread-6] com.alibaba.dubbo.rpc.filter.ExceptionFilter -  [DUBBO] Got unchecked and undeclared exception which called by 192.168.13.246. service: cn.wizzer.app.sys.modules.services.SysTenantRoleService, method: getRoleMenus, exception: org.nutz.dao.DaoException: Invalid @One(field=table_id) 'language' : class cn.wizzer.app.sys.modules.models.Sys_tb_menu<=>class cn.wizzer.app.sys.modules.models.Sys_tb_language, dubbo version: 2.6.7, current host: 192.168.13.246
org.nutz.dao.DaoException: Invalid @One(field=table_id) 'language' : class cn.wizzer.app.sys.modules.models.Sys_tb_menu<=>class cn.wizzer.app.sys.modules.models.Sys_tb_language
	at org.nutz.dao.impl.entity.field.OneLinkField.<init>(OneLinkField.java:38)
	at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:292)
	at org.nutz.dao.impl.EntityHolder.getEntity(EntityHolder.java:72)
	at org.nutz.dao.impl.NutDao.getEntity(NutDao.java:866)
	at org.nutz.service.EntityService.getEntity(EntityService.java:98)
	at cn.wizzer.framework.base.service.BaseServiceImpl.getEntity(BaseServiceImpl.java:43)
	at cn.wizzer.framework.base.service.BaseServiceImpl.listEntity(BaseServiceImpl.java:914)
	at cn.wizzer.app.sys.modules.services.impl.SysTenantRoleServiceImpl.getRoleMenus(SysTenantRoleServiceImpl.java:156)
	at cn.wizzer.app.sys.modules.services.impl.SysTenantRoleServiceImpl$$NUTZAOP._aop_invoke(SysTenantRoleServiceImpl.java:3)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.plugins.wkcache.WkcacheResultInterceptor.filter(WkcacheResultInterceptor.java:75)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.wizzer.app.sys.modules.services.impl.SysTenantRoleServiceImpl$$NUTZAOP.getRoleMenus(SysTenantRoleServiceImpl.java:1)
	at com.alibaba.dubbo.common.bytecode.Wrapper22.invokeMethod(Wrapper22.java)
	at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47)
	at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76)
	at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52)
	at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
	at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62)
3 回复

table_id这个字段是关联字段啊,我感觉设置没有问题啊@@@

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