例外
org.hibernate.exception.GenericJDBCException: could not execute query
org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.doList(Loader.java:1596)
org.hibernate.loader.Loader.list(Loader.java:1577)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
com.web.dao.UsersDAO.find(UsersDAO.java:75)
com.web.service.UsersService.usersList(UsersService.java:17)
com.web.struts.action.GridAction.execute(GridAction.java:59)
org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
代码
public List find(int start, int limit, String sort, String dir) {
try {
List results = null;
this.getSession().flush();
Query query = this.getSession().createQuery(
"from Users as u order by u. " + sort + " " + dir + " ");
query.setFirstResult(start);
query.setMaxResults(limit);
results = query.list(); return results;
} catch (RuntimeException re) { throw re;
}
}
public int count() {
try {
String hsql = "select count(id) from Users ";
return ((Integer) this.getSession().createQuery(hsql).iterate()
.next()).intValue();
} catch (RuntimeException re) { throw re;
} finally {
this.getSession().close();
}
}
------解决方案--------------------
看看这个 http://haolla.com/wy
http://www.haolla.com/girls/index.asp
------解决方案--------------------
顶楼主,那个四处乱丢垃圾的家伙好讨厌
------解决方案--------------------
sort跟dir如果是两个字段,那应该用逗号分隔而不是空格
------解决方案--------------------
sort的值是什么
------解决方案--------------------
检查
com.web.struts.action.GridAction.execute(GridAction.java:59)
向find方法传递sort参数的时候,是什么值,如果这个值不正确,例如 " ",那么可能查询出错。
如果我没猜错,这个sort参数是从jsp页面一直传递下去的。
------解决方案--------------------
发广告的人太多了
鄙视