]]>璇鋒暀涓涓猦ibernate瀵筸ysql鐨勫垎欏甸棶棰?/title>http://www.aygfsteel.com/samshi/archive/2007/04/23/112957.htmlsamfreesamfreeMon, 23 Apr 2007 07:11:00 GMThttp://www.aygfsteel.com/samshi/archive/2007/04/23/112957.htmlhttp://www.aygfsteel.com/samshi/comments/112957.htmlhttp://www.aygfsteel.com/samshi/archive/2007/04/23/112957.html#Feedback5http://www.aygfsteel.com/samshi/comments/commentRss/112957.htmlhttp://www.aygfsteel.com/samshi/services/trackbacks/112957.html鎴戝湪鐢╤ibernate瀵筸ysql榪涜鍒嗛〉鐨勬柟娉?br>/** * 鍑芥暟璇存槑錛氳幏寰楁墍鏈夌殑淇℃伅 * 鍙傛暟璇存槑錛? * 榪斿洖鍊鹼細(xì)淇℃伅鐨勯泦鍚?br> */ public List getProducts(final int pageSize, final int startRow) throws HibernateException { return this.getHibernateTemplate().executeFind(new HibernateCallback(){
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query query=session.createQuery("FROM Products as p"); query.setMaxResults(pageSize); query.setFirstResult(startRow);
List list = query.list();
return list; } });
}
榪愯鏃舵庝箞鑰佺粰鍑哄紓甯擱樋錛熻甯府鎴戠湅鐪嬪ソ鍚楋紵 org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query org.hibernate.exception.SQLGrammarException: could not execute query java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '40 products0_.game_id as game1_0_, products0_.game_name_en as game2_0_, products' at line 1"