NutzCN Logo
问答 调用存储过程返回Bean转换报错,请问返回数据集怎么处理?
发布于 2045天前 作者 qq_6d75074b 1384 次浏览 复制 上一个帖子 下一个帖子
标签:

cn.pacPacinforeport cannot be cast to java.util.List

			Sql sql = Sqls.fetchEntity("CALL proc_pacinfosum(@vyear,@hospitalid)");
			sql.setEntity(dao.getEntity(Pacinforeport.class));
			sql.params().set("vyear", year);
			sql.params().set("hospitalid", this.getLoginHospital().getId());
			dao.execute(sql);
			return super.nutzRet(0, "数据查询成功!", sql.getList(Pacinforeport.class));

import org.nutz.dao.entity.annotation.Column;

public class Pacinforeport {
	@Column(hump = true)
	private String type;
	@Column(hump = true)
	private String optionval;
	@Column(hump = true)
	private int y1;
	@Column(hump = true)
	private int y2;
	@Column(hump = true)
	private int y3;
	@Column(hump = true)
	private int y4;
	@Column(hump = true)
	private int y5;
	@Column(hump = true)
	private int y6;
	@Column(hump = true)
	private int y7;
	@Column(hump = true)
	private int y8;
	@Column(hump = true)
	private int y9;
	@Column(hump = true)
	private int y10;
	@Column(hump = true)
	private int y11;
	@Column(hump = true)
	private int y12;

	/**
	 * @return type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type 要设置的 type
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * @return optionval
	 */
	public String getOptionval() {
		return optionval;
	}

	/**
	 * @param optionval 要设置的 optionval
	 */
	public void setOptionval(String optionval) {
		this.optionval = optionval;
	}

	/**
	 * @return y1
	 */
	public int getY1() {
		return y1;
	}

	/**
	 * @param y1 要设置的 y1
	 */
	public void setY1(int y1) {
		this.y1 = y1;
	}

	/**
	 * @return y2
	 */
	public int getY2() {
		return y2;
	}

	/**
	 * @param y2 要设置的 y2
	 */
	public void setY2(int y2) {
		this.y2 = y2;
	}

	/**
	 * @return y3
	 */
	public int getY3() {
		return y3;
	}

	/**
	 * @param y3 要设置的 y3
	 */
	public void setY3(int y3) {
		this.y3 = y3;
	}

	/**
	 * @return y4
	 */
	public int getY4() {
		return y4;
	}

	/**
	 * @param y4 要设置的 y4
	 */
	public void setY4(int y4) {
		this.y4 = y4;
	}

	/**
	 * @return y5
	 */
	public int getY5() {
		return y5;
	}

	/**
	 * @param y5 要设置的 y5
	 */
	public void setY5(int y5) {
		this.y5 = y5;
	}

	/**
	 * @return y6
	 */
	public int getY6() {
		return y6;
	}

	/**
	 * @param y6 要设置的 y6
	 */
	public void setY6(int y6) {
		this.y6 = y6;
	}

	/**
	 * @return y7
	 */
	public int getY7() {
		return y7;
	}

	/**
	 * @param y7 要设置的 y7
	 */
	public void setY7(int y7) {
		this.y7 = y7;
	}

	/**
	 * @return y8
	 */
	public int getY8() {
		return y8;
	}

	/**
	 * @param y8 要设置的 y8
	 */
	public void setY8(int y8) {
		this.y8 = y8;
	}

	/**
	 * @return y9
	 */
	public int getY9() {
		return y9;
	}

	/**
	 * @param y9 要设置的 y9
	 */
	public void setY9(int y9) {
		this.y9 = y9;
	}

	/**
	 * @return y10
	 */
	public int getY10() {
		return y10;
	}

	/**
	 * @param y10 要设置的 y10
	 */
	public void setY10(int y10) {
		this.y10 = y10;
	}

	/**
	 * @return y11
	 */
	public int getY11() {
		return y11;
	}

	/**
	 * @param y11 要设置的 y11
	 */
	public void setY11(int y11) {
		this.y11 = y11;
	}

	/**
	 * @return y12
	 */
	public int getY12() {
		return y12;
	}

	/**
	 * @param y12 要设置的 y12
	 */
	public void setY12(int y12) {
		this.y12 = y12;
	}
}

3 回复
java.lang.ClassCastException: cn.bean.Pacinforeport cannot be cast to java.util.List
2019-04-11 09:00:34,430 cn.core.mvc.LogTimeProcessor.process(LogTimeProcessor.java:28) DEBUG - [POST]URI=/pac/pacinfo/reportByYear 46ms
	at org.nutz.dao.impl.sql.NutStatement.getList(NutStatement.java:127)
	at cn.pac.module.PacinfoModule.reportByYear(PacinfoModule.java:91)
	at cn.pac.module.PacinfoModule$FM$reportByYear$0cd2c2ce56adc5fb4252054264994b76.invoke(PacinfoModule.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.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.core.mvc.LogTimeProcessor.process(LogTimeProcessor.java:23)
	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 cn.core.mvc.MyNutFilter.doFilter(MyNutFilter.java:37)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at cn.core.util.XFilter.doFilter(XFilter.java:25)
	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:490)
	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:668)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

fetchEntity改成queryEntity

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