求解SSH查询数据问题
getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session session) throws
HibernateException,
SQLException {
XXXXX
});
调用这个方法按条件查询数据时带参数查询 报错Source not found for NewsServiceImpl$$FastClassByCGLIB$$c30e8202.invoke(int, Object, Object[]) line: not available
但是查询find()方法不报错 求解
------解决方案--------------------属性注入失败?
------解决方案--------------------@SuppressWarnings("unchecked")
public List<InstantInfomation> getInfomation(final Paging page) {
List<InstantInfomation> infoList = null;
try {
// 本地sql
final String sqlString = "select * from (select rownum r,info.* from Instant_infomation info) where r>:numOne and r<=:numTwo order by info_date desc";
// spring封装的函数无法满足我们的要求时可以使用spring的回调函数。
infoList = (List<InstantInfomation>) super.getHibernateTemplate()
.execute(new HibernateCallback() {
public Object doInHibernate(Session arg0)
throws HibernateException, SQLException {
List<InstantInfomation> list = null;
Query query = arg0.createSQLQuery(sqlString).addEntity(InstantInfomation.class);
query.setInteger("numOne", (page.getCurrentPage() - 1)
* page.getInfoNum());
query.setParameter("numTwo",
page.getCurrentPage() * page.getInfoNum());
list = query.list();
return list;
}
});
} catch (DataAccessException d) {
d.printStackTrace();
}
return infoList;
}
刚做不久的,可以参考下...