NutzCN Logo
问答 执行dao.insertWIth(...) 出现错误 null ele in linked field
发布于 2275天前 作者 qq_edffd6b4 1833 次浏览 复制 上一个帖子 下一个帖子
标签:

执行dao.insertWIth(...) 出现错误 null ele in linked field

对象

@Table("ordertable")
public class Order extends BasePojo{
	@Id
	@Column
	private int user_order_id;
	@Column
	private int order_status;
	
	@Many(target =OrderApplicant.class,field="user_order_id")
	private OrderApplicant[] applicant={};
	
@Table("orderapplicant")
public class OrderApplicant {
	@Id
	private int order_applicant_id;
	private String applicant_name;
	private int user_order_id;

插入操作

public Order add(Order order){
		return this.dao().insertWith(order,null);
	}

报错误

java.lang.NullPointerException: null ele in linked field!!
	at org.nutz.dao.impl.link.DoInsertLinkVisitor$2.invoke(DoInsertLinkVisitor.java:39)
	at org.nutz.lang.Lang.each(Lang.java:1585)
	at org.nutz.lang.Lang.each(Lang.java:1550)
	at org.nutz.dao.impl.link.DoInsertLinkVisitor.visit(DoInsertLinkVisitor.java:36)
	at org.nutz.dao.impl.entity.LinkFieldSet.visit(LinkFieldSet.java:41)
	at org.nutz.dao.impl.entity.NutEntity.visitMany(NutEntity.java:320)
	at org.nutz.dao.impl.NutDao.insertWith(NutDao.java:214)
	at easyvisa.service.OrderService.add(OrderService.java:16)
	at easyvisa.module.OrderModule.order_add(OrderModule.java:115)
	at easyvisa.module.OrderModule$FM$order_add$62a45dd556d0f42121639f961f8c6c2d.invoke(OrderModule.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	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:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:412)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	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)
1 回复

解决了。
是order对象的applicant,虽然初始化了,但是这个对象数组中的元素都是null。就是这个原因了。

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