NutzCN Logo
问答 sql查询出现空指针问题
发布于 2834天前 作者 qq_152b6ff2 2186 次浏览 复制 上一个帖子 下一个帖子
标签:
@At("/main_info")
	@Ok("jsp:jsp.work.designRequire.main_info")
	public Map<String, Object> toMainInfo(@Param("nmSqbId")Integer nmSqbId){
		Map<String, Object> result = new HashMap<String, Object>();
		QfgCompanyInfo companyInfo = dao.fetch(QfgCompanyInfo.class, nmSqbId);
		QfgProjectInfo projectInfo = dao.fetch(QfgProjectInfo.class, nmSqbId);
		QfgDesignRequire designRequire = dao.fetch(QfgDesignRequire.class, nmSqbId);
		Criteria cri = Cnd.cri();
		cri.where().andEquals("nmSqbId", nmSqbId);
		cri.getOrderBy().asc("nmCompanyId");
		List<QfgCompanyInfo> companyInfoList = dao.query(QfgCompanyInfo.class, cri);
		result.put("nmSqbId", nmSqbId);
		result.put("projectInfo", projectInfo);
		result.put("designRequire", designRequire);
		result.put("companyInfoList", companyInfoList);
		return result;
	}
6 回复
DEBUG 13:58:10 UrlMappingImpl.get(101)-->Found mapping for [POST] path=/designRequire/main_info : DesignRequireAt.toMainInfo(DesignRequireAt.java:64)
DEBUG 13:58:10 NutIoc.get(151)-->Get 'designRequireAt'<class com.wonders.ghqfg.work.DesignRequireAt>
WARN 13:58:10 FailProcessor.process(28)-->Error@/designRequire/main_info :
java.lang.NullPointerException
	at com.wonders.ghqfg.work.DesignRequireAt.toMainInfo(DesignRequireAt.java:65)
	at com.wonders.ghqfg.work.DesignRequireAt$$FASTCLASS._invoke(DesignRequireAt.java:1)
	at org.nutz.lang.reflect.AbstractFastClass.invoke(AbstractFastClass.java:143)
	at org.nutz.lang.reflect.FastClassFactory.invoke(FastClassFactory.java:67)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:27)
	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:198)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	at java.lang.Thread.run(Thread.java:619)

新进入页面的时候nmSqbId是为空值的 请问这个时候空值的处理是应该在数据库创建新序列然后根据这个新nmSqbId进行查询 但是我尝试这样写的时候就不可以= =

@wendal 就是说改成 cri.OrderBy().asc("nmCompanyId");这样么

@wendal 那我之前写的在已有nmSqbId时 进行查询是可以的呀

具体是哪一行空指针, 那一行的代码贴一下

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