org.hibernate.exception.SQLGrammarException: could not execute query

Hibernate JIRA | Sven Henckel | 1 decade ago
  1. 0

    There is a problem with the new ANTLR-based query parser and a correlated subquery. The code below works fine with the latest beta versions of Hibernate 3 as well as with Hibernate 3.0rc1 using the ClassicQueryTranslatorFactory. Code causing the error: final Session session = HibernateUtil.getSession(); HibernateUtil.beginTransaction(); final StringBuilder queryString = new StringBuilder(). append("SELECT ls FROM LectureSequence AS ls "). append("JOIN ls.course.students AS studs "). append("WHERE (studs.username = :username) "). append("AND ls.questionnairesPublishedDate IS NOT NULL "). append("AND ls.questionnairesPublishedDate <= :today "). append("AND NOT EXISTS (FROM SurveyParticipation AS sp "). append("WHERE (sp.lectureSequence = ls) "). append("AND (sp.student.username = :username)) "). append("ORDER BY ls.questionnairesPublishedDate ASC, ls.subject.name ASC"); final Query query = session.createQuery(queryString.toString()); query.setString("username", username); query.setDate("today", Calendar.getInstance().getTime()); final List lectureSequences = query.list(); HibernateUtil.commitTransaction(); Full stack trace of any exception that occurs: WARN 28.02.2005 23:55:34,482 org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter:logExceptions:57) - SQL Error: 1054, SQLState: 42S22 ERROR 28.02.2005 23:55:34,482 org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter:logExceptions:58) - Unknown column 'ls' in 'where clause' WARN 28.02.2005 23:55:34,492 org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter:logExceptions:57) - SQL Error: 1054, SQLState: 42S22 ERROR 28.02.2005 23:55:34,492 org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter:logExceptions:58) - Unknown column 'ls' in 'where clause' WARN 28.02.2005 23:55:34,722 org.apache.struts.action.RequestProcessor (RequestProcessor:processException:507) - Unhandled Exception thrown: class org.hibernate.exception.SQLGrammarException ERROR 28.02.2005 23:55:34,722 StandardWrapper[/w3s:action] (StandardWrapperValve:invoke:269) - Servlet.service() for servlet action threw exception org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:1502) at org.hibernate.loader.Loader.list(Loader.java:1482) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at de.w3s.webapp.struts.actions.SelectBlankQuestionnairesAction.execute(SelectBlankQuestionnairesAction.java:42) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source) Caused by: java.sql.SQLException: Unknown column 'ls' in 'where clause' at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534) at com.mysql.jdbc.ServerPreparedStatement.serverPrepare(ServerPreparedStatement.java:1485) at com.mysql.jdbc.ServerPreparedStatement.<init>(ServerPreparedStatement.java:151) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1309) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1281) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:351) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:302) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:85) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1090) at org.hibernate.loader.Loader.doQuery(Loader.java:362) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203) at org.hibernate.loader.Loader.doList(Loader.java:1499) ... 27 more The generated SQL: select lectureseq0_.id as id, lectureseq0_.subject_id as subject2_4_, lectureseq0_.lecturer_id as lecturer3_4_, lectureseq0_.course_id as course4_4_, lectureseq0_.questionnaire_template_id as question5_4_, lectureseq0_.location as location4_, lectureseq0_.start_date as start7_4_, lectureseq0_.end_date as end8_4_, lectureseq0_.questionnaires_published_date as question9_4_ from lecture_sequences lectureseq0_ inner join courses course1_ on lectureseq0_.course_id=course1_.id inner join users students2_ on course1_.id=students2_.course_id, subjects subject5_ where (students2_.username=? and (lectureseq0_.questionnaires_published_date is not null) and lectureseq0_.questionnaires_published_date<=? and not (exists (select surveypart3_.id from survey_participations surveypart3_, users student4_ where (surveypart3_.lecture_sequence_id=ls and student4_.username=? and surveypart3_.student_id=student4_.id))) and lectureseq0_.subject_id=subject5_.id) order by lectureseq0_.questionnaires_published_date ASC , subject5_.name ASC HQL AST: \-[QUERY] CommonAST: 'query' +-[SELECT_FROM] CommonAST: 'SELECT_FROM' | +-[FROM] CommonAST: 'FROM' | | +-[DOT] CommonAST: '.' | | | +-[DOT] CommonAST: '.' | | | | +-[DOT] CommonAST: '.' | | | | | +-[IDENT] CommonAST: 'de' | | | | | \-[IDENT] CommonAST: 'w3s' | | | | \-[IDENT] CommonAST: 'persistence' | | | \-[IDENT] CommonAST: 'LectureSequence' | | +-[ALIAS] CommonAST: 'ls' | | \-[JOIN] CommonAST: 'JOIN' | | +-[DOT] CommonAST: '.' | | | +-[DOT] CommonAST: '.' | | | | +-[IDENT] CommonAST: 'ls' | | | | \-[IDENT] CommonAST: 'course' | | | \-[IDENT] CommonAST: 'students' | | \-[ALIAS] CommonAST: 'studs' | \-[SELECT] CommonAST: 'SELECT' | \-[IDENT] CommonAST: 'ls' +-[WHERE] CommonAST: 'WHERE' | \-[AND] CommonAST: 'AND' | +-[AND] CommonAST: 'AND' | | +-[AND] CommonAST: 'AND' | | | +-[EQ] CommonAST: '=' | | | | +-[DOT] CommonAST: '.' | | | | | +-[IDENT] CommonAST: 'studs' | | | | | \-[IDENT] CommonAST: 'username' | | | | \-[COLON] CommonAST: ':' | | | | \-[IDENT] CommonAST: 'username' | | | \-[IS_NOT_NULL] CommonAST: 'is not null' | | | \-[DOT] CommonAST: '.' | | | +-[IDENT] CommonAST: 'ls' | | | \-[IDENT] CommonAST: 'questionnairesPublishedDate' | | \-[LE] CommonAST: '<=' | | +-[DOT] CommonAST: '.' | | | +-[IDENT] CommonAST: 'ls' | | | \-[IDENT] CommonAST: 'questionnairesPublishedDate' | | \-[COLON] CommonAST: ':' | | \-[IDENT] CommonAST: 'today' | \-[NOT] CommonAST: 'not' | \-[EXISTS] CommonAST: 'EXISTS' | \-[QUERY] CommonAST: 'query' | +-[SELECT_FROM] CommonAST: 'SELECT_FROM' | | \-[FROM] CommonAST: 'FROM' | | +-[DOT] CommonAST: '.' | | | +-[DOT] CommonAST: '.' | | | | +-[DOT] CommonAST: '.' | | | | | +-[IDENT] CommonAST: 'de' | | | | | \-[IDENT] CommonAST: 'w3s' | | | | \-[IDENT] CommonAST: 'persistence' | | | \-[IDENT] CommonAST: 'SurveyParticipation' | | \-[ALIAS] CommonAST: 'sp' | \-[WHERE] CommonAST: 'WHERE' | \-[AND] CommonAST: 'AND' | +-[EQ] CommonAST: '=' | | +-[DOT] CommonAST: '.' | | | +-[IDENT] CommonAST: 'sp' | | | \-[IDENT] CommonAST: 'lectureSequence' | | \-[IDENT] CommonAST: 'ls' | \-[EQ] CommonAST: '=' | +-[DOT] CommonAST: '.' | | +-[DOT] CommonAST: '.' | | | +-[IDENT] CommonAST: 'sp' | | | \-[IDENT] CommonAST: 'student' | | \-[IDENT] CommonAST: 'username' | \-[COLON] CommonAST: ':' | \-[IDENT] CommonAST: 'username' \-[ORDER] CommonAST: 'ORDER' +-[DOT] CommonAST: '.' | +-[IDENT] CommonAST: 'ls' | \-[IDENT] CommonAST: 'questionnairesPublishedDate' +-[ASCENDING] CommonAST: 'ASC' +-[DOT] CommonAST: '.' | +-[DOT] CommonAST: '.' | | +-[IDENT] CommonAST: 'ls' | | \-[IDENT] CommonAST: 'subject' | \-[IDENT] CommonAST: 'name' \-[ASCENDING] CommonAST: 'ASC' SQL AST: \-[SELECT] QueryNode: 'SELECT' querySpaces (courses,users,subjects,survey_participations,lecture_sequences) +-[SELECT_CLAUSE] SelectClause: '{select clause}' | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id as id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | \-[SQL_TOKEN] SqlFragment: 'lectureseq0_.subject_id as subject2_4_, lectureseq0_.lecturer_id as lecturer3_4_, lectureseq0_.course_id as course4_4_, lectureseq0_.questionnaire_template_id as question5_4_, lectureseq0_.location as location4_, lectureseq0_.start_date as start7_4_, lectureseq0_.end_date as end8_4_, lectureseq0_.questionnaires_published_date as question9_4_' +-[FROM] FromClause: 'FROM' FromClause{FROM} | +-[FROM_FRAGMENT] FromElement: 'lecture_sequences lectureseq0_' FromElement{explicit,not a collection join,classAlias=ls,role=null,tableName=lecture_sequences,tableAlias=lectureseq0_,colums={,className=de.w3s.persistence.LectureSequence}} | | \-[JOIN_FRAGMENT] ImpliedFromElement: 'inner join courses course1_ on lectureseq0_.course_id=course1_.id' ImpliedFromElement{implied in FROM clause,not a collection join,classAlias=null,role=null,tableName=courses,tableAlias=course1_,colums={lectureseq0_.course_id ,className=de.w3s.persistence.Course}} | | \-[JOIN_FRAGMENT] FromElement: 'inner join users students2_ on course1_.id=students2_.course_id' FromElement{explicit,not a collection join,classAlias=studs,role=de.w3s.persistence.Course.students,tableName=users,tableAlias=students2_,colums={course1_.id ,className=de.w3s.persistence.Student}} | \-[FROM_FRAGMENT] ImpliedFromElement: 'subjects subject5_' ImpliedFromElement{implied,not a collection join,classAlias=null,role=null,tableName=subjects,tableAlias=subject5_,colums={lectureseq0_.subject_id ,className=de.w3s.persistence.Subject}} +-[WHERE] SqlNode: 'WHERE' | +-[AND] SqlNode: 'AND' | | +-[AND] SqlNode: 'AND' | | | +-[AND] SqlNode: 'AND' | | | | +-[EQ] SqlNode: '=' | | | | | +-[DOT] DotNode: 'students2_.username' {propertyName=username,dereferenceType=4,propertyPath=username,path=studs.username,tableAlias=students2_,className=de.w3s.persistence.Student,classAlias=studs} | | | | | | +-[ALIAS_REF] IdentNode: 'students2_.id' {alias=studs, className=de.w3s.persistence.Student, tableAlias=students2_} | | | | | | \-[IDENT] IdentNode: 'username' {originalText=username} | | | | | \-[NAMED_PARAM] SqlNode: '?' | | | | \-[IS_NOT_NULL] SqlNode: 'is not null' | | | | \-[DOT] DotNode: 'lectureseq0_.questionnaires_published_date' {propertyName=questionnairesPublishedDate,dereferenceType=4,propertyPath=questionnairesPublishedDate,path=ls.questionnairesPublishedDate,tableAlias=lectureseq0_,className=de.w3s.persistence.LectureSequence,classAlias=ls} | | | | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | | | | \-[IDENT] IdentNode: 'questionnairesPublishedDate' {originalText=questionnairesPublishedDate} | | | \-[LE] SqlNode: '<=' | | | +-[DOT] DotNode: 'lectureseq0_.questionnaires_published_date' {propertyName=questionnairesPublishedDate,dereferenceType=4,propertyPath=questionnairesPublishedDate,path=ls.questionnairesPublishedDate,tableAlias=lectureseq0_,className=de.w3s.persistence.LectureSequence,classAlias=ls} | | | | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | | | | \-[IDENT] IdentNode: 'questionnairesPublishedDate' {originalText=questionnairesPublishedDate} | | | \-[NAMED_PARAM] SqlNode: '?' | | \-[NOT] SqlNode: 'not' | | \-[EXISTS] SqlNode: 'EXISTS' | | \-[SELECT] QueryNode: 'SELECT' querySpaces (courses,users,subjects,survey_participations,lecture_sequences) | | +-[SELECT_CLAUSE] SelectClause: '{derived select clause}' | | | \-[SELECT_EXPR] SelectExpressionImpl: 'surveypart3_.id' {FromElement{explicit,not a collection join,classAlias=sp,role=null,tableName=survey_participations,tableAlias=surveypart3_,colums={,className=de.w3s.persistence.SurveyParticipation}}} | | +-[FROM] FromClause: 'FROM' FromClause{FROM} | | | +-[FROM_FRAGMENT] FromElement: 'survey_participations surveypart3_' FromElement{explicit,not a collection join,classAlias=sp,role=null,tableName=survey_participations,tableAlias=surveypart3_,colums={,className=de.w3s.persistence.SurveyParticipation}} | | | \-[FROM_FRAGMENT] ImpliedFromElement: 'users student4_' ImpliedFromElement{implied,not a collection join,classAlias=null,role=null,tableName=users,tableAlias=student4_,colums={surveypart3_.student_id ,className=de.w3s.persistence.Student}} | | \-[WHERE] SqlNode: 'WHERE' | | +-[AND] SqlNode: 'AND' | | | +-[EQ] SqlNode: '=' | | | | +-[DOT] DotNode: 'surveypart3_.lecture_sequence_id' {propertyName=lectureSequence,dereferenceType=ROOT_LEVEL,propertyPath=lectureSequence,path=sp.lectureSequence,tableAlias=surveypart3_,className=de.w3s.persistence.SurveyParticipation,classAlias=sp} | | | | | +-[ALIAS_REF] IdentNode: 'surveypart3_.id' {alias=sp, className=de.w3s.persistence.SurveyParticipation, tableAlias=surveypart3_} | | | | | \-[IDENT] IdentNode: 'lectureSequence' {originalText=lectureSequence} | | | | \-[IDENT] IdentNode: 'ls' {originalText=ls} | | | \-[EQ] SqlNode: '=' | | | +-[DOT] DotNode: 'student4_.username' {propertyName=username,dereferenceType=4,propertyPath=username,path=sp.student.username,tableAlias=student4_,className=de.w3s.persistence.Student,classAlias=null} | | | | +-[DOT] DotNode: 'surveypart3_.student_id' {propertyName=student,dereferenceType=1,propertyPath=student,path=sp.student,tableAlias=student4_,className=de.w3s.persistence.Student,classAlias=null} | | | | | +-[ALIAS_REF] IdentNode: 'surveypart3_.id' {alias=sp, className=de.w3s.persistence.SurveyParticipation, tableAlias=surveypart3_} | | | | | \-[IDENT] IdentNode: 'student' {originalText=student} | | | | \-[IDENT] IdentNode: 'username' {originalText=username} | | | \-[NAMED_PARAM] SqlNode: '?' | | \-[THETA_JOINS] SqlNode: '{theta joins}' | | \-[SQL_TOKEN] SqlFragment: 'surveypart3_.student_id=student4_.id' | \-[THETA_JOINS] SqlNode: '{theta joins}' | \-[SQL_TOKEN] SqlFragment: 'lectureseq0_.subject_id=subject5_.id' \-[ORDER] OrderByClause: 'ORDER' +-[DOT] DotNode: 'lectureseq0_.questionnaires_published_date' {propertyName=questionnairesPublishedDate,dereferenceType=4,propertyPath=questionnairesPublishedDate,path=ls.questionnairesPublishedDate,tableAlias=lectureseq0_,className=de.w3s.persistence.LectureSequence,classAlias=ls} | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | \-[IDENT] IdentNode: 'questionnairesPublishedDate' {originalText=questionnairesPublishedDate} +-[ASCENDING] SqlNode: 'ASC' +-[DOT] DotNode: 'subject5_.name' {propertyName=name,dereferenceType=4,propertyPath=name,path=ls.subject.name,tableAlias=subject5_,className=de.w3s.persistence.Subject,classAlias=null} | +-[DOT] DotNode: 'lectureseq0_.subject_id' {propertyName=subject,dereferenceType=1,propertyPath=subject,path=ls.subject,tableAlias=subject5_,className=de.w3s.persistence.Subject,classAlias=null} | | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | | \-[IDENT] IdentNode: 'subject' {originalText=subject} | \-[IDENT] IdentNode: 'name' {originalText=name} \-[ASCENDING] SqlNode: 'ASC' Please see these posting for further information: http://forum.hibernate.org/viewtopic.php?t=939320 http://forum.hibernate.org/viewtopic.php?t=939412

    Hibernate JIRA | 1 decade ago | Sven Henckel
    org.hibernate.exception.SQLGrammarException: could not execute query
  2. 0

    There is a problem with the new ANTLR-based query parser and a correlated subquery. The code below works fine with the latest beta versions of Hibernate 3 as well as with Hibernate 3.0rc1 using the ClassicQueryTranslatorFactory. Code causing the error: final Session session = HibernateUtil.getSession(); HibernateUtil.beginTransaction(); final StringBuilder queryString = new StringBuilder(). append("SELECT ls FROM LectureSequence AS ls "). append("JOIN ls.course.students AS studs "). append("WHERE (studs.username = :username) "). append("AND ls.questionnairesPublishedDate IS NOT NULL "). append("AND ls.questionnairesPublishedDate <= :today "). append("AND NOT EXISTS (FROM SurveyParticipation AS sp "). append("WHERE (sp.lectureSequence = ls) "). append("AND (sp.student.username = :username)) "). append("ORDER BY ls.questionnairesPublishedDate ASC, ls.subject.name ASC"); final Query query = session.createQuery(queryString.toString()); query.setString("username", username); query.setDate("today", Calendar.getInstance().getTime()); final List lectureSequences = query.list(); HibernateUtil.commitTransaction(); Full stack trace of any exception that occurs: WARN 28.02.2005 23:55:34,482 org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter:logExceptions:57) - SQL Error: 1054, SQLState: 42S22 ERROR 28.02.2005 23:55:34,482 org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter:logExceptions:58) - Unknown column 'ls' in 'where clause' WARN 28.02.2005 23:55:34,492 org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter:logExceptions:57) - SQL Error: 1054, SQLState: 42S22 ERROR 28.02.2005 23:55:34,492 org.hibernate.util.JDBCExceptionReporter (JDBCExceptionReporter:logExceptions:58) - Unknown column 'ls' in 'where clause' WARN 28.02.2005 23:55:34,722 org.apache.struts.action.RequestProcessor (RequestProcessor:processException:507) - Unhandled Exception thrown: class org.hibernate.exception.SQLGrammarException ERROR 28.02.2005 23:55:34,722 StandardWrapper[/w3s:action] (StandardWrapperValve:invoke:269) - Servlet.service() for servlet action threw exception org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:1502) at org.hibernate.loader.Loader.list(Loader.java:1482) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at de.w3s.webapp.struts.actions.SelectBlankQuestionnairesAction.execute(SelectBlankQuestionnairesAction.java:42) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source) Caused by: java.sql.SQLException: Unknown column 'ls' in 'where clause' at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534) at com.mysql.jdbc.ServerPreparedStatement.serverPrepare(ServerPreparedStatement.java:1485) at com.mysql.jdbc.ServerPreparedStatement.<init>(ServerPreparedStatement.java:151) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1309) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1281) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:351) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:302) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:85) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1090) at org.hibernate.loader.Loader.doQuery(Loader.java:362) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203) at org.hibernate.loader.Loader.doList(Loader.java:1499) ... 27 more The generated SQL: select lectureseq0_.id as id, lectureseq0_.subject_id as subject2_4_, lectureseq0_.lecturer_id as lecturer3_4_, lectureseq0_.course_id as course4_4_, lectureseq0_.questionnaire_template_id as question5_4_, lectureseq0_.location as location4_, lectureseq0_.start_date as start7_4_, lectureseq0_.end_date as end8_4_, lectureseq0_.questionnaires_published_date as question9_4_ from lecture_sequences lectureseq0_ inner join courses course1_ on lectureseq0_.course_id=course1_.id inner join users students2_ on course1_.id=students2_.course_id, subjects subject5_ where (students2_.username=? and (lectureseq0_.questionnaires_published_date is not null) and lectureseq0_.questionnaires_published_date<=? and not (exists (select surveypart3_.id from survey_participations surveypart3_, users student4_ where (surveypart3_.lecture_sequence_id=ls and student4_.username=? and surveypart3_.student_id=student4_.id))) and lectureseq0_.subject_id=subject5_.id) order by lectureseq0_.questionnaires_published_date ASC , subject5_.name ASC HQL AST: \-[QUERY] CommonAST: 'query' +-[SELECT_FROM] CommonAST: 'SELECT_FROM' | +-[FROM] CommonAST: 'FROM' | | +-[DOT] CommonAST: '.' | | | +-[DOT] CommonAST: '.' | | | | +-[DOT] CommonAST: '.' | | | | | +-[IDENT] CommonAST: 'de' | | | | | \-[IDENT] CommonAST: 'w3s' | | | | \-[IDENT] CommonAST: 'persistence' | | | \-[IDENT] CommonAST: 'LectureSequence' | | +-[ALIAS] CommonAST: 'ls' | | \-[JOIN] CommonAST: 'JOIN' | | +-[DOT] CommonAST: '.' | | | +-[DOT] CommonAST: '.' | | | | +-[IDENT] CommonAST: 'ls' | | | | \-[IDENT] CommonAST: 'course' | | | \-[IDENT] CommonAST: 'students' | | \-[ALIAS] CommonAST: 'studs' | \-[SELECT] CommonAST: 'SELECT' | \-[IDENT] CommonAST: 'ls' +-[WHERE] CommonAST: 'WHERE' | \-[AND] CommonAST: 'AND' | +-[AND] CommonAST: 'AND' | | +-[AND] CommonAST: 'AND' | | | +-[EQ] CommonAST: '=' | | | | +-[DOT] CommonAST: '.' | | | | | +-[IDENT] CommonAST: 'studs' | | | | | \-[IDENT] CommonAST: 'username' | | | | \-[COLON] CommonAST: ':' | | | | \-[IDENT] CommonAST: 'username' | | | \-[IS_NOT_NULL] CommonAST: 'is not null' | | | \-[DOT] CommonAST: '.' | | | +-[IDENT] CommonAST: 'ls' | | | \-[IDENT] CommonAST: 'questionnairesPublishedDate' | | \-[LE] CommonAST: '<=' | | +-[DOT] CommonAST: '.' | | | +-[IDENT] CommonAST: 'ls' | | | \-[IDENT] CommonAST: 'questionnairesPublishedDate' | | \-[COLON] CommonAST: ':' | | \-[IDENT] CommonAST: 'today' | \-[NOT] CommonAST: 'not' | \-[EXISTS] CommonAST: 'EXISTS' | \-[QUERY] CommonAST: 'query' | +-[SELECT_FROM] CommonAST: 'SELECT_FROM' | | \-[FROM] CommonAST: 'FROM' | | +-[DOT] CommonAST: '.' | | | +-[DOT] CommonAST: '.' | | | | +-[DOT] CommonAST: '.' | | | | | +-[IDENT] CommonAST: 'de' | | | | | \-[IDENT] CommonAST: 'w3s' | | | | \-[IDENT] CommonAST: 'persistence' | | | \-[IDENT] CommonAST: 'SurveyParticipation' | | \-[ALIAS] CommonAST: 'sp' | \-[WHERE] CommonAST: 'WHERE' | \-[AND] CommonAST: 'AND' | +-[EQ] CommonAST: '=' | | +-[DOT] CommonAST: '.' | | | +-[IDENT] CommonAST: 'sp' | | | \-[IDENT] CommonAST: 'lectureSequence' | | \-[IDENT] CommonAST: 'ls' | \-[EQ] CommonAST: '=' | +-[DOT] CommonAST: '.' | | +-[DOT] CommonAST: '.' | | | +-[IDENT] CommonAST: 'sp' | | | \-[IDENT] CommonAST: 'student' | | \-[IDENT] CommonAST: 'username' | \-[COLON] CommonAST: ':' | \-[IDENT] CommonAST: 'username' \-[ORDER] CommonAST: 'ORDER' +-[DOT] CommonAST: '.' | +-[IDENT] CommonAST: 'ls' | \-[IDENT] CommonAST: 'questionnairesPublishedDate' +-[ASCENDING] CommonAST: 'ASC' +-[DOT] CommonAST: '.' | +-[DOT] CommonAST: '.' | | +-[IDENT] CommonAST: 'ls' | | \-[IDENT] CommonAST: 'subject' | \-[IDENT] CommonAST: 'name' \-[ASCENDING] CommonAST: 'ASC' SQL AST: \-[SELECT] QueryNode: 'SELECT' querySpaces (courses,users,subjects,survey_participations,lecture_sequences) +-[SELECT_CLAUSE] SelectClause: '{select clause}' | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id as id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | \-[SQL_TOKEN] SqlFragment: 'lectureseq0_.subject_id as subject2_4_, lectureseq0_.lecturer_id as lecturer3_4_, lectureseq0_.course_id as course4_4_, lectureseq0_.questionnaire_template_id as question5_4_, lectureseq0_.location as location4_, lectureseq0_.start_date as start7_4_, lectureseq0_.end_date as end8_4_, lectureseq0_.questionnaires_published_date as question9_4_' +-[FROM] FromClause: 'FROM' FromClause{FROM} | +-[FROM_FRAGMENT] FromElement: 'lecture_sequences lectureseq0_' FromElement{explicit,not a collection join,classAlias=ls,role=null,tableName=lecture_sequences,tableAlias=lectureseq0_,colums={,className=de.w3s.persistence.LectureSequence}} | | \-[JOIN_FRAGMENT] ImpliedFromElement: 'inner join courses course1_ on lectureseq0_.course_id=course1_.id' ImpliedFromElement{implied in FROM clause,not a collection join,classAlias=null,role=null,tableName=courses,tableAlias=course1_,colums={lectureseq0_.course_id ,className=de.w3s.persistence.Course}} | | \-[JOIN_FRAGMENT] FromElement: 'inner join users students2_ on course1_.id=students2_.course_id' FromElement{explicit,not a collection join,classAlias=studs,role=de.w3s.persistence.Course.students,tableName=users,tableAlias=students2_,colums={course1_.id ,className=de.w3s.persistence.Student}} | \-[FROM_FRAGMENT] ImpliedFromElement: 'subjects subject5_' ImpliedFromElement{implied,not a collection join,classAlias=null,role=null,tableName=subjects,tableAlias=subject5_,colums={lectureseq0_.subject_id ,className=de.w3s.persistence.Subject}} +-[WHERE] SqlNode: 'WHERE' | +-[AND] SqlNode: 'AND' | | +-[AND] SqlNode: 'AND' | | | +-[AND] SqlNode: 'AND' | | | | +-[EQ] SqlNode: '=' | | | | | +-[DOT] DotNode: 'students2_.username' {propertyName=username,dereferenceType=4,propertyPath=username,path=studs.username,tableAlias=students2_,className=de.w3s.persistence.Student,classAlias=studs} | | | | | | +-[ALIAS_REF] IdentNode: 'students2_.id' {alias=studs, className=de.w3s.persistence.Student, tableAlias=students2_} | | | | | | \-[IDENT] IdentNode: 'username' {originalText=username} | | | | | \-[NAMED_PARAM] SqlNode: '?' | | | | \-[IS_NOT_NULL] SqlNode: 'is not null' | | | | \-[DOT] DotNode: 'lectureseq0_.questionnaires_published_date' {propertyName=questionnairesPublishedDate,dereferenceType=4,propertyPath=questionnairesPublishedDate,path=ls.questionnairesPublishedDate,tableAlias=lectureseq0_,className=de.w3s.persistence.LectureSequence,classAlias=ls} | | | | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | | | | \-[IDENT] IdentNode: 'questionnairesPublishedDate' {originalText=questionnairesPublishedDate} | | | \-[LE] SqlNode: '<=' | | | +-[DOT] DotNode: 'lectureseq0_.questionnaires_published_date' {propertyName=questionnairesPublishedDate,dereferenceType=4,propertyPath=questionnairesPublishedDate,path=ls.questionnairesPublishedDate,tableAlias=lectureseq0_,className=de.w3s.persistence.LectureSequence,classAlias=ls} | | | | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | | | | \-[IDENT] IdentNode: 'questionnairesPublishedDate' {originalText=questionnairesPublishedDate} | | | \-[NAMED_PARAM] SqlNode: '?' | | \-[NOT] SqlNode: 'not' | | \-[EXISTS] SqlNode: 'EXISTS' | | \-[SELECT] QueryNode: 'SELECT' querySpaces (courses,users,subjects,survey_participations,lecture_sequences) | | +-[SELECT_CLAUSE] SelectClause: '{derived select clause}' | | | \-[SELECT_EXPR] SelectExpressionImpl: 'surveypart3_.id' {FromElement{explicit,not a collection join,classAlias=sp,role=null,tableName=survey_participations,tableAlias=surveypart3_,colums={,className=de.w3s.persistence.SurveyParticipation}}} | | +-[FROM] FromClause: 'FROM' FromClause{FROM} | | | +-[FROM_FRAGMENT] FromElement: 'survey_participations surveypart3_' FromElement{explicit,not a collection join,classAlias=sp,role=null,tableName=survey_participations,tableAlias=surveypart3_,colums={,className=de.w3s.persistence.SurveyParticipation}} | | | \-[FROM_FRAGMENT] ImpliedFromElement: 'users student4_' ImpliedFromElement{implied,not a collection join,classAlias=null,role=null,tableName=users,tableAlias=student4_,colums={surveypart3_.student_id ,className=de.w3s.persistence.Student}} | | \-[WHERE] SqlNode: 'WHERE' | | +-[AND] SqlNode: 'AND' | | | +-[EQ] SqlNode: '=' | | | | +-[DOT] DotNode: 'surveypart3_.lecture_sequence_id' {propertyName=lectureSequence,dereferenceType=ROOT_LEVEL,propertyPath=lectureSequence,path=sp.lectureSequence,tableAlias=surveypart3_,className=de.w3s.persistence.SurveyParticipation,classAlias=sp} | | | | | +-[ALIAS_REF] IdentNode: 'surveypart3_.id' {alias=sp, className=de.w3s.persistence.SurveyParticipation, tableAlias=surveypart3_} | | | | | \-[IDENT] IdentNode: 'lectureSequence' {originalText=lectureSequence} | | | | \-[IDENT] IdentNode: 'ls' {originalText=ls} | | | \-[EQ] SqlNode: '=' | | | +-[DOT] DotNode: 'student4_.username' {propertyName=username,dereferenceType=4,propertyPath=username,path=sp.student.username,tableAlias=student4_,className=de.w3s.persistence.Student,classAlias=null} | | | | +-[DOT] DotNode: 'surveypart3_.student_id' {propertyName=student,dereferenceType=1,propertyPath=student,path=sp.student,tableAlias=student4_,className=de.w3s.persistence.Student,classAlias=null} | | | | | +-[ALIAS_REF] IdentNode: 'surveypart3_.id' {alias=sp, className=de.w3s.persistence.SurveyParticipation, tableAlias=surveypart3_} | | | | | \-[IDENT] IdentNode: 'student' {originalText=student} | | | | \-[IDENT] IdentNode: 'username' {originalText=username} | | | \-[NAMED_PARAM] SqlNode: '?' | | \-[THETA_JOINS] SqlNode: '{theta joins}' | | \-[SQL_TOKEN] SqlFragment: 'surveypart3_.student_id=student4_.id' | \-[THETA_JOINS] SqlNode: '{theta joins}' | \-[SQL_TOKEN] SqlFragment: 'lectureseq0_.subject_id=subject5_.id' \-[ORDER] OrderByClause: 'ORDER' +-[DOT] DotNode: 'lectureseq0_.questionnaires_published_date' {propertyName=questionnairesPublishedDate,dereferenceType=4,propertyPath=questionnairesPublishedDate,path=ls.questionnairesPublishedDate,tableAlias=lectureseq0_,className=de.w3s.persistence.LectureSequence,classAlias=ls} | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | \-[IDENT] IdentNode: 'questionnairesPublishedDate' {originalText=questionnairesPublishedDate} +-[ASCENDING] SqlNode: 'ASC' +-[DOT] DotNode: 'subject5_.name' {propertyName=name,dereferenceType=4,propertyPath=name,path=ls.subject.name,tableAlias=subject5_,className=de.w3s.persistence.Subject,classAlias=null} | +-[DOT] DotNode: 'lectureseq0_.subject_id' {propertyName=subject,dereferenceType=1,propertyPath=subject,path=ls.subject,tableAlias=subject5_,className=de.w3s.persistence.Subject,classAlias=null} | | +-[ALIAS_REF] IdentNode: 'lectureseq0_.id' {alias=ls, className=de.w3s.persistence.LectureSequence, tableAlias=lectureseq0_} | | \-[IDENT] IdentNode: 'subject' {originalText=subject} | \-[IDENT] IdentNode: 'name' {originalText=name} \-[ASCENDING] SqlNode: 'ASC' Please see these posting for further information: http://forum.hibernate.org/viewtopic.php?t=939320 http://forum.hibernate.org/viewtopic.php?t=939412

    Hibernate JIRA | 1 decade ago | Sven Henckel
    org.hibernate.exception.SQLGrammarException: could not execute query
  3. 0

    jBPM开发入门指南(3) - 子在川上曰 - BlogJava

    blogjava.net | 2 weeks ago
    org.hibernate.exception.SQLGrammarException: could not execute query
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Installing a clean confluence on jboss 3.2.6 fails when configured to use mysql 4.1.9, mysql-connector-java-3.1.6 as a datasource. Attached is a zip with the INFO and higher logs of my appserver Last part of web.xml: <resource-ref> <description>Connection Pool</description> <res-ref-name>jdbc/confluence</res-ref-name> <res-type>javax.sql.Datasource</res-type> <res-auth>Container</res-auth> </resource-ref> jboss-web.xml: <?xml version="1.0" encoding="UTF-8"?> <jboss-web> <resource-ref> <res-ref-name>jdbc/confluence</res-ref-name> <res-type>javax.sql.DataSource</res-type> <jndi-name>java:/jdbc/confluence</jndi-name> </resource-ref> </jboss-web> datasource configured in jboss: <?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <!-- The jndi name of the DataSource, it is prefixed with java:/ --> <!-- Datasources are not available outside the virtual machine --> <jndi-name>jdbc/confluence</jndi-name> <connection-url>jdbc:mysql://localhost:3306/confluence?password=dummy&amp;user=dummy&amp;autoReconnect=true</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <min-pool-size>5</min-pool-size> <max-pool-size>20</max-pool-size> <idle-timeout-minutes>10</idle-timeout-minutes> <track-statements>false</track-statements> <prepared-statement-cache-size>100</prepared-statement-cache-size> </local-tx-datasource> </datasources> Bug report from confluence: Cause: org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: 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 '?' at line 1 Stack Trace: [hide] org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: 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 '?' at line 1 java.sql.SQLException: 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 '?' at line 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534) at com.mysql.jdbc.ServerPreparedStatement.serverPrepare(ServerPreparedStatement.java:1485) at com.mysql.jdbc.ServerPreparedStatement.(ServerPreparedStatement.java:151) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1309) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1281) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:374) at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:217) at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249) at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:223) at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65) at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704) at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133) at net.sf.hibernate.loader.Loader.doList(Loader.java:958) at net.sf.hibernate.loader.Loader.list(Loader.java:943) at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:846) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39) at bucket.core.persistence.hibernate.HibernateObjectDao$4.doInHibernate(HibernateObjectDao.java:331) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:200) at org.springframework.orm.hibernate.HibernateTemplate.executeFind(HibernateTemplate.java:220) at bucket.core.persistence.hibernate.HibernateObjectDao.findNamedQueryStringParams(HibernateObjectDao.java:312) at bucket.core.persistence.hibernate.HibernateObjectDao.findNamedQueryStringParams(HibernateObjectDao.java:297) at bucket.core.persistence.hibernate.HibernateObjectDao.findNamedQueryStringParams(HibernateObjectDao.java:282) at bucket.core.persistence.hibernate.HibernateObjectDao.findNamedQueryStringParam(HibernateObjectDao.java:267) at com.atlassian.confluence.links.persistence.dao.hibernate.HibernateReferralDao.findHotReferrers(HibernateReferralDao.java:30) at com.atlassian.confluence.links.DefaultReferralManager.reallyGetHotReferrers(DefaultReferralManager.java:91) at com.atlassian.confluence.links.DefaultReferralManager.getHotReferrers(DefaultReferralManager.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:149) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116) at com.atlassian.confluence.util.profiling.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:16) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152) at $Proxy57.getHotReferrers(Unknown Source) at com.atlassian.confluence.pages.actions.ViewPageAction.execute(ViewPageAction.java:104) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.intercept(DefaultWorkflowInterceptor.java:55) at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:33) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.atlassian.confluence.core.ConfluenceValidationInterceptor.intercept(ConfluenceValidationInterceptor.java:16) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.security.actions.PermissionCheckInterceptor.intercept(PermissionCheckInterceptor.java:40) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.pages.actions.PageAwareInterceptor.intercept(PageAwareInterceptor.java:73) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.core.ConfluenceAutowireInterceptor.intercept(ConfluenceAutowireInterceptor.java:25) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.user.actions.AuthenticatedUserInterceptor.intercept(AuthenticatedUserInterceptor.java:51) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.util.XWorkTransactionInterceptor.intercept(XWorkTransactionInterceptor.java:133) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:115) at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:229) at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:199) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at com.atlassian.confluence.servlet.simpledisplay.SimpleDisplayServlet.doGet(SimpleDisplayServlet.java:44) at javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118) at com.atlassian.confluence.util.profiling.ProfilingPageFilter.parsePage(ProfilingPageFilter.java:159) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:168) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.atlassian.seraph.filter.LoginFilter.doFilter(LoginFilter.java:181) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.atlassian.johnson.filters.JohnsonFilter.doFilter(JohnsonFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170) at bucket.custom.FlushingSpringSessionInViewFilter.doFilterInternal(FlushingSpringSessionInViewFilter.java:30) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:73) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.atlassian.util.profiling.filters.ProfilingFilter.doFilter(ProfilingFilter.java:132) at com.atlassian.confluence.util.error.ProfilingAndErrorFilter.doFilter(ProfilingAndErrorFilter.java:27) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at com.atlassian.core.filters.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:158) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) Referer URL: http://localhost/confluence/spaces/listspaces.action Build Information: Uptime: 5 minutes, 21 seconds Version: 1.3.5 Build Number: 122 Server Information: Application Server: Apache Tomcat/5.0.28 Servlet Version: 2.4 Database Dialect: bucket.dialect.MySQLDialect Memory Information: Total Memory: 127 MB Free Memory: 77 MB Used Memory: 50 MB System Information: System Date: woensdag, 09 mrt 2005 System Time: 13:30:50 System Favourite Colour: Lime Java Version: 1.4.2_07 Java Vendor: Sun Microsystems Inc. JVM Version: 1.0 JVM Vendor: Sun Microsystems Inc. JVM Implementation Version: 1.4.2_07-b05 Java Runtime: Java(TM) 2 Runtime Environment, Standard Edition Java VM: Java HotSpot(TM) Client VM User Name: Administrator User Timezone: Europe/Berlin Operating System: Windows 2000 5.0 OS Architecture: x86 Request Information: URL: http://localhost/confluence/display/ds/Confluence+Overview - Scheme: http - Server: localhost - Port: 80 - URI: /confluence/500page.jsp - - Context Path: /confluence - - Servlet Path: /500page.jsp - - Path Info: null - - Query String: null Attributes: - javax.servlet.forward.request_uri : /confluence/display/ds/Confluence+Overview - javax.servlet.forward.context_path : /confluence - javax.servlet.forward.servlet_path : /display - javax.servlet.forward.path_info : /500page.jsp - javax.servlet.error.exception : org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: 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 '?' at line 1 - javax.servlet.error.message : - os_securityfilter_already_filtered : true - com.atlassian.johnson.filters.JohnsonFilter_already_filtered : true - __sitemesh__using_stream : false - javax.servlet.error.request_uri : /confluence/display/ds/Confluence+Overview - javax.servlet.error.status_code : 500 - __sitemesh__filterapplied : true - javax.servlet.error.servlet_name : simple-display - webwork.valueStack : com.opensymphony.xwork.util.OgnlValueStack@11cfd52 - loginfilter.already.filtered : true - atlassian.core.seraph.original.url : /display/ds/Confluence+Overview - javax.servlet.jsp.jspException : org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: 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 '?' at line 1 - sessioninview.FILTERED : true Parameters: Logging: 0 log statements generated by this request.

    Atlassian JIRA | 1 decade ago | Jan Zeinstra
    java.sql.SQLException: 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 '?' at line 1
  6. 0

    MySQL Bugs: #9465: Syntax error when using a prepared statement and limit

    mysql.com | 4 months ago
    java.sql.SQLException: 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 '?' at line 1

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.sql.SQLException

      Unknown column 'ls' in 'where clause'

      at com.mysql.jdbc.MysqlIO.checkErrorPacket()
    2. MySQL jdbc
      Connection.prepareStatement
      1. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851)
      2. com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534)
      3. com.mysql.jdbc.ServerPreparedStatement.serverPrepare(ServerPreparedStatement.java:1485)
      4. com.mysql.jdbc.ServerPreparedStatement.<init>(ServerPreparedStatement.java:151)
      5. com.mysql.jdbc.Connection.prepareStatement(Connection.java:1309)
      6. com.mysql.jdbc.Connection.prepareStatement(Connection.java:1281)
      6 frames
    3. Hibernate
      QueryLoader.list
      1. org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:351)
      2. org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:302)
      3. org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:85)
      4. org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1090)
      5. org.hibernate.loader.Loader.doQuery(Loader.java:362)
      6. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
      7. org.hibernate.loader.Loader.doList(Loader.java:1499)
      8. org.hibernate.loader.Loader.list(Loader.java:1482)
      9. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:365)
      9 frames
    4. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.list
      1. org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268)
      1 frame
    5. Hibernate
      QueryImpl.list
      1. org.hibernate.impl.SessionImpl.list(SessionImpl.java:782)
      2. org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
      2 frames
    6. de.w3s.webapp
      SelectBlankQuestionnairesAction.execute
      1. de.w3s.webapp.struts.actions.SelectBlankQuestionnairesAction.execute(SelectBlankQuestionnairesAction.java:42)
      1 frame
    7. struts
      ActionServlet.doGet
      1. org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
      2. org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
      3. org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
      4. org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
      4 frames
    8. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      2 frames
    9. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
      6. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      7. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      8. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      9. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      9 frames
    10. Grizzly HTTP
      LeaderFollowerWorkerThread.runIt
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
      3. org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
      4. org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      4 frames
    11. Tomcat Util
      ThreadPool$ControlRunnable.run
      1. org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      1 frame
    12. Java RT
      Thread.run
      1. java.lang.Thread.run(Unknown Source)
      1 frame