NutzCN Logo
问答 dao.query 一对多映射的问题
发布于 10天前 作者 daiwenlong 43 次浏览 复制 上一个帖子 下一个帖子
标签:
/**
	 * 一对多映射
	 */
	@Many(target = LfPersonTagsBo.class,field = "rk_id")
	private List<LfPersonTagsBo> tags;
	
	public List<LfPersonTagsBo> getTags() {
		return tags;
	}
	public void setTags(List<LfPersonTagsBo> tags) {
		this.tags = tags;
	}
	List<LfPersonInfoBo> list = dao.query(LfPersonInfoBo.class, Cnd.where("fw_id", "=", fwId));
WARN 10:05:30 FailProcessor.process(28)-->Error@/visit/inHouse :
java.lang.RuntimeException: Invalid @Many(field=rk_id) 'tags' : class com.wonders.lfpc.entity.LfPersonInfoBo<=>class com.wonders.lfpc.entity.LfPersonTagsBo
	at org.nutz.lang.Lang.makeThrow(Lang.java:104)
	at org.nutz.dao.impl.entity.field.ManyLinkField.<init>(ManyLinkField.java:36)
	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.NutDao.query(NutDao.java:459)
	at org.nutz.dao.impl.NutDao.query(NutDao.java:470)
	at com.wonders.lfpc.query.VisitAt.toHouseDeatail(VisitAt.java:172)
	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:497)
	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 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:196)
	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:170)
	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:316)
	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)

查询列表是否可以实现一对多映射?

4 回复

dao.query是不包含关联关系的, dao.queryByJoin/dao.fetchLinks才有关联关系

我看了一下,好像没有 dao.queryByJoin

用的版本比较老吧?

确实,我还是换成1.r.6吧

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