1.在登录appfuse项目查询对象列表时,报错:
在使用
return super.getHibernateTemplate().find("from Otacity");进行结果查询的时候:
异常信息:
Otacity is not mapped [from Otacity]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Otacity is not mapped [from Otacity]
经查找发现 project/src/main/resources/hibernate.cfg.xml 文件中仅有
这里appfuse没有自动添加,需要手动添加. 已经证实没有添加这个的时候查询结果为0
2.另外,在原始的appfuse自动生成代码中,只有下面的getAll方法,而如果没有在cfg文件中添加映射,则执行下面的方法也不报错,但是结果记录数为0.
public List getAll() {
return super.getHibernateTemplate().loadAll(this.persistentClass);
}