NutzCN Logo
短点 NewBe项目访问数据库出错了
发布于 2527天前 作者 qq_6c5a7e9a 2175 次浏览 复制 上一个帖子 下一个帖子
标签:

父类:

@IocBean
public class BaseDao {
	@Inject
	private NutDao dao;

	protected List<JSONObject> getArray(HashMap<String, Object> params) {
		String sqlName = Thread.currentThread().getStackTrace()[2].getClassName()+"."+Thread.currentThread().getStackTrace()[2].getMethodName();
		Sql sql = dao.sqls().create(sqlName);
		for (String name : params.keySet()) {
			sql.setParam(name, params.get(name));
		}
		sql.setEntity(dao.getEntity(JSONObject.class));
		sql.setCallback(Sqls.callback.entities());
		return dao.execute(sql).getList(JSONObject.class);
	}
}

子类:

@IocBean
public class UitilDao extends BaseDao{
	public List<JSONObject> getCantons(boolean getParent) {
		return getArray(new HashMap<String,Object>(){
			private static final long serialVersionUID = 1L;
			{put("getParent", getParent);}
		});
	}
}

错误信息:

Caused by: org.nutz.lang.born.BorningException: Fail to born or cast to 'com.hetaro.dao.UitilDao'
 by args: [@(org.nutz.dao.impl.NutDao@60febfd1)]
 because: No suitable Constructor or Factory Method!!
	at org.nutz.lang.Mirror.born(Mirror.java:1008)
	at org.nutz.castor.castor.Object2Object.cast(Object2Object.java:12)
	at org.nutz.castor.Castors.cast(Castors.java:252)
	... 55 more
1 回复

这个分类没人看到的。

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