NutzCN Logo
问答 @Many报错 Fail to find hostField for @Many(field=billid) 's_saledetail'
发布于 2843天前 作者 Mr.Hu 2698 次浏览 复制 上一个帖子 下一个帖子
标签:

以下是我的两个类

/**
	 * 83.销售单据明细
	 */
	@Many(target = S_saledetail.class, field = "billid")
	private List<S_saledetail> s_saledetail;
	
	public List<S_saledetail> getS_saledetail() {
		return s_saledetail;
	}
	public void setS_saledetail(List<S_saledetail> s_saledetail) {
		this.s_saledetail = s_saledetail;
	}

第二个

@Table("s_saledetail")
public class S_saledetail {	
	/**
	 * 1.
	 */
	@Column("billid")
	private Integer billid;

get set方法都有设置. 这是为啥呀

11 回复

S_sale sale;
执行dao().insert(sale)时报错了

2017-03-11 16:06:13,043 com.bsdkj.bms.common.mvc.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) DEBUG - [POST]URI=/bms/private/xskd/add/do 85ms
2017-03-11 16:06:13,044 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN  - Error@/private/xskd/add/do :
java.lang.RuntimeException: Fail to find hostField for @Many(field=billid) 's_saledetail' : class com.bsdkj.bms.modules.mvc.bean.suda.sale.S_sale<=>class com.bsdkj.bms.modules.mvc.bean.suda.sale.S_saledetail
	at org.nutz.lang.Lang.makeThrow(Lang.java:104)
	at org.nutz.dao.impl.entity.field.ManyLinkField.<init>(ManyLinkField.java:51)
	at org.nutz.dao.impl.entity.AnnotationEntityMaker.make(AnnotationEntityMaker.java:265)
	at org.nutz.dao.impl.EntityHolder.getEntity(EntityHolder.java:69)
	at org.nutz.dao.impl.EntityHolder.getEntityBy(EntityHolder.java:194)
	at org.nutz.dao.impl.NutDao._optBy(NutDao.java:935)
	at org.nutz.dao.impl.NutDao.insertWith(NutDao.java:209)
	at com.bsdkj.bms.modules.mvc.service.XskdService.insertbill(XskdService.java:219)
	at com.bsdkj.bms.modules.mvc.service.XskdService$$NUTZAOP._aop_invoke(XskdService.java:1)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.bsdkj.bms.modules.mvc.service.XskdService$$NUTZAOP.insertbill(XskdService.java:1)
	at com.bsdkj.bms.modules.mvc.Action.XskdAction.addo(XskdAction.java:67)
	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:483)
	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 com.bsdkj.bms.common.mvc.processor.NutShiroProcessor.process(NutShiroProcessor.java:54)
	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 com.bsdkj.bms.common.mvc.processor.XSSProcessor.process(XSSProcessor.java:43)
	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.bsdkj.bms.common.mvc.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:18)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.bsdkj.bms.common.mvc.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:196)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at com.bsdkj.bms.common.mvc.filter.XssFilter.doFilter(XssFilter.java:23)
	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:505)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
	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:745)

额,必须是主键啊...

Many还有个key属性

还是这个问题,我用了key但还是报错,不知道自己写的对不对

	/**
	 * 80.从表s_orderdetail
	 */
	@Many(target = S_saledetail.class,  key = "billid", field = "billid")
	private List<S_orderdetail> s_orderdetail;

这个billid 不是主键

这个billid 在 主表中不是主键 但还是报这个错误

恩?两边的属性名都是一样的?

嗯嗯 是一样的,实在不行我改下bean吧.

Invalid @Many(field=billpid) 's_orderdetail' : class com.bsdkj.bms.modules.mvc.bean.suda.sale.S_order<=>class com.bsdkj.bms.modules.mvc.bean.suda.sale.S_saledetail

改bean好像不行,数据库的人就把这两个字段写成一样的了.

对应的是@Column("")中的字段名称 那个没法改了.

是属性名称,不是字段名

另外,nutz版本是多少?用1.r.60 o哦

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