Hibernate中query.setParameter加不上参数.....
StringqueryString="select*Topicasmodelwheremodel.boardId=?limit1,6";Queryquery=this.g...
String queryString = "select * Topic as model where model.boardId=? limit 1,6";
Query query = this.getSession().createSQLQuery(queryString);
query.setParameter(0, 1);//这句debug下好像没赋值
List list= query.list();
最后报错
org.hibernate.exception.SQLGrammarException: could not execute query
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
org.hibernate.loader.Loader.doList(Loader.java:2235)
请问这是怎么回事啊,总是搞不好 展开
Query query = this.getSession().createSQLQuery(queryString);
query.setParameter(0, 1);//这句debug下好像没赋值
List list= query.list();
最后报错
org.hibernate.exception.SQLGrammarException: could not execute query
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
org.hibernate.loader.Loader.doList(Loader.java:2235)
请问这是怎么回事啊,总是搞不好 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询