This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Spring + Hibernate ORA-00936: missing expression

Jun 28th, 2005, 06:57 AM

Hi,

I 've got some problems when using spring with hibernate and Oracle.

I receceive this error when I execute a select on a single table.

Code:

11&#58;08&#58;13,855 INFO &#91;SQLErrorCodesFactory&#93; SQLErrorCodes loaded&#58; &#91;DB2, HSQL, MS-SQL, MySQL, Oracle, Informix, PostgreSQL, Sybase&#93;
11&#58;08&#58;13,871 INFO &#91;STDOUT&#93; Hibernate&#58; select from
11&#58;08&#58;13,887 WARN &#91;JDBCExceptionReporter&#93; SQL Error&#58; 936, SQLState&#58; 42000
11&#58;08&#58;13,887 ERROR &#91;JDBCExceptionReporter&#93; ORA-00936&#58; missing expression
11&#58;08&#58;13,887 WARN &#91;JDBCExceptionReporter&#93; SQL Error&#58; 936, SQLState&#58; 42000
11&#58;08&#58;13,887 ERROR &#91;JDBCExceptionReporter&#93; ORA-00936&#58; missing expression
11&#58;08&#58;13,887 ERROR &#91;JDBCExceptionReporter&#93; Could not execute query
java.sql.SQLException&#58; ORA-00936&#58; missing expression
at oracle.jdbc.dbaccess.DBError.throwSqlException&#40;DBError.java&#58;134&#41;
at oracle.jdbc.ttc7.TTIoer.processError&#40;TTIoer.java&#58;289&#41;
at oracle.jdbc.ttc7.Oall7.receive&#40;Oall7.java&#58;573&#41;
at oracle.jdbc.ttc7.TTC7Protocol.doOall7&#40;TTC7Protocol.java&#58;1891&#41;
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe&#40;TTC7Protocol.java&#58;830&#41;
at oracle.jdbc.driver.OracleStatement.doExecuteQuery&#40;OracleStatement.java&#58;2391&#41;
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout&#40;OracleStatement.java&#58;2672&#41;
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate&#40;OraclePreparedStatement.java&#58;589&#41;
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery&#40;OraclePreparedStatement.java&#58;527&#41;
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery&#40;WrappedPreparedStatement.java&#58;296&#41;
at net.sf.hibernate.impl.BatcherImpl.getResultSet&#40;BatcherImpl.java&#58;87&#41;
at net.sf.hibernate.loader.Loader.getResultSet&#40;Loader.java&#58;875&#41;
at net.sf.hibernate.loader.Loader.doQuery&#40;Loader.java&#58;269&#41;
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections&#40;Loader.java&#58;133&#41;
at net.sf.hibernate.loader.Loader.doList&#40;Loader.java&#58;1033&#41;
at net.sf.hibernate.loader.Loader.list&#40;Loader.java&#58;1024&#41;
at net.sf.hibernate.hql.QueryTranslator.list&#40;QueryTranslator.java&#58;854&#41;
at net.sf.hibernate.impl.SessionImpl.find&#40;SessionImpl.java&#58;1544&#41;
at net.sf.hibernate.impl.QueryImpl.list&#40;QueryImpl.java&#58;39&#41;
at org.springframework.orm.hibernate.HibernateTemplate$19.doInHibernate&#40;HibernateTemplate.java&#58;647&#41;
at org.springframework.orm.hibernate.HibernateTemplate.execute&#40;HibernateTemplate.java&#58;314&#41;
at org.springframework.orm.hibernate.HibernateTemplate.find&#40;HibernateTemplate.java&#58;633&#41;
at org.springframework.orm.hibernate.HibernateTemplate.find&#40;HibernateTemplate.java&#58;612&#41;
at be.brail.tutorial.dao.db.implementations.hibernate.EmployeeDAOImpl.listOfEmployees&#40;EmployeeDAOImpl.java&#58;25&#41;
at be.brail.tutorial.services.implementations.EmployeeServiceImpl.ListOfEmployee&#40;EmployeeServiceImpl.java&#58;31&#41;
at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
at java.lang.reflect.Method.invoke&#40;Method.java&#58;585&#41;
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection&#40;AopUtils.java&#58;288&#41;
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint&#40;ReflectiveMethodInvocation.java&#58;155&#41;
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed&#40;ReflectiveMethodInvocation.java&#58;122&#41;
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke&#40;TransactionInterceptor.java&#58;57&#41;
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed&#40;ReflectiveMethodInvocation.java&#58;144&#41;
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke&#40;JdkDynamicAopProxy.java&#58;174&#41;
at $Proxy65.ListOfEmployee&#40;Unknown Source&#41;
at be.brail.tutorial.struts.actions.EmployeeListAction.execute&#40;EmployeeListAction.java&#58;44&#41;
at org.apache.struts.action.RequestProcessor.processActionPerform&#40;RequestProcessor.java&#58;484&#41;
at org.apache.struts.action.RequestProcessor.process&#40;RequestProcessor.java&#58;274&#41;
at org.apache.struts.action.ActionServlet.process&#40;ActionServlet.java&#58;1482&#41;
at org.apache.struts.action.ActionServlet.doGet&#40;ActionServlet.java&#58;507&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;697&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;810&#41;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;252&#41;
at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41;
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter&#40;ReplyHeaderFilter.java&#58;75&#41;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;202&#41;
at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41;
at org.apache.catalina.core.StandardWrapperValve.invoke&#40;StandardWrapperValve.java&#58;213&#41;
at org.apache.catalina.core.StandardContextValve.invoke&#40;StandardContextValve.java&#58;178&#41;
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke&#40;CustomPrincipalValve.java&#58;39&#41;
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke&#40;SecurityAssociationValve.java&#58;147&#41;
at org.jboss.web.tomcat.security.JaccContextValve.invoke&#40;JaccContextValve.java&#58;53&#41;
at org.apache.catalina.core.StandardHostValve.invoke&#40;StandardHostValve.java&#58;126&#41;
at org.apache.catalina.valves.ErrorReportValve.invoke&#40;ErrorReportValve.java&#58;105&#41;
at org.apache.catalina.core.StandardEngineValve.invoke&#40;StandardEngineValve.java&#58;107&#41;
at org.apache.catalina.connector.CoyoteAdapter.service&#40;CoyoteAdapter.java&#58;148&#41;
at org.apache.coyote.http11.Http11Processor.process&#40;Http11Processor.java&#58;825&#41;
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection&#40;Http11Protocol.java&#58;743&#41;
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket&#40;PoolTcpEndpoint.java&#58;527&#41;
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run&#40;MasterSlaveWorkerThread.java&#58;112&#41;
at java.lang.Thread.run&#40;Thread.java&#58;595&#41;
11&#58;08&#58;13,902 WARN &#91;RequestProcessor&#93; Unhandled Exception thrown&#58; class org.springframework.jdbc.BadSqlGrammarException
11&#58;08&#58;13,902 ERROR &#91;StandardWrapper&#91;/Employee-tutorial&#58;action&#93;&#93; Servlet.service&#40;&#41; for servlet action threw exception
org.springframework.jdbc.BadSqlGrammarException&#58; Hibernate operation&#58; Could not execute query; bad SQL grammar &#91;&#93;; nested exception is java.sql.SQLException&#58; ORA-00936&#58; missing expression
java.sql.SQLException&#58; ORA-00936&#58; missing expression
at oracle.jdbc.dbaccess.DBError.throwSqlException&#40;DBError.java&#58;134&#41;
at oracle.jdbc.ttc7.TTIoer.processError&#40;TTIoer.java&#58;289&#41;
at oracle.jdbc.ttc7.Oall7.receive&#40;Oall7.java&#58;573&#41;
at oracle.jdbc.ttc7.TTC7Protocol.doOall7&#40;TTC7Protocol.java&#58;1891&#41;
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe&#40;TTC7Protocol.java&#58;830&#41;
at oracle.jdbc.driver.OracleStatement.doExecuteQuery&#40;OracleStatement.java&#58;2391&#41;
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout&#40;OracleStatement.java&#58;2672&#41;
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate&#40;OraclePreparedStatement.java&#58;589&#41;
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery&#40;OraclePreparedStatement.java&#58;527&#41;
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery&#40;WrappedPreparedStatement.java&#58;296&#41;
at net.sf.hibernate.impl.BatcherImpl.getResultSet&#40;BatcherImpl.java&#58;87&#41;
at net.sf.hibernate.loader.Loader.getResultSet&#40;Loader.java&#58;875&#41;
at net.sf.hibernate.loader.Loader.doQuery&#40;Loader.java&#58;269&#41;
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections&#40;Loader.java&#58;133&#41;
at net.sf.hibernate.loader.Loader.doList&#40;Loader.java&#58;1033&#41;
at net.sf.hibernate.loader.Loader.list&#40;Loader.java&#58;1024&#41;
at net.sf.hibernate.hql.QueryTranslator.list&#40;QueryTranslator.java&#58;854&#41;
at net.sf.hibernate.impl.SessionImpl.find&#40;SessionImpl.java&#58;1544&#41;
at net.sf.hibernate.impl.QueryImpl.list&#40;QueryImpl.java&#58;39&#41;
at org.springframework.orm.hibernate.HibernateTemplate$19.doInHibernate&#40;HibernateTemplate.java&#58;647&#41;
at org.springframework.orm.hibernate.HibernateTemplate.execute&#40;HibernateTemplate.java&#58;314&#41;
at org.springframework.orm.hibernate.HibernateTemplate.find&#40;HibernateTemplate.java&#58;633&#41;
at org.springframework.orm.hibernate.HibernateTemplate.find&#40;HibernateTemplate.java&#58;612&#41;
at be.brail.tutorial.dao.db.implementations.hibernate.EmployeeDAOImpl.listOfEmployees&#40;EmployeeDAOImpl.java&#58;25&#41;
at be.brail.tutorial.services.implementations.EmployeeServiceImpl.ListOfEmployee&#40;EmployeeServiceImpl.java&#58;31&#41;
at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
at java.lang.reflect.Method.invoke&#40;Method.java&#58;585&#41;
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection&#40;AopUtils.java&#58;288&#41;
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint&#40;ReflectiveMethodInvocation.java&#58;155&#41;
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed&#40;ReflectiveMethodInvocation.java&#58;122&#41;
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke&#40;TransactionInterceptor.java&#58;57&#41;
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed&#40;ReflectiveMethodInvocation.java&#58;144&#41;
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke&#40;JdkDynamicAopProxy.java&#58;174&#41;
at $Proxy65.ListOfEmployee&#40;Unknown Source&#41;
at be.brail.tutorial.struts.actions.EmployeeListAction.execute&#40;EmployeeListAction.java&#58;44&#41;
at org.apache.struts.action.RequestProcessor.processActionPerform&#40;RequestProcessor.java&#58;484&#41;
at org.apache.struts.action.RequestProcessor.process&#40;RequestProcessor.java&#58;274&#41;
at org.apache.struts.action.ActionServlet.process&#40;ActionServlet.java&#58;1482&#41;
at org.apache.struts.action.ActionServlet.doGet&#40;ActionServlet.java&#58;507&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;697&#41;
at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;810&#41;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;252&#41;
at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41;
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter&#40;ReplyHeaderFilter.java&#58;75&#41;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;202&#41;
at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41;
at org.apache.catalina.core.StandardWrapperValve.invoke&#40;StandardWrapperValve.java&#58;213&#41;
at org.apache.catalina.core.StandardContextValve.invoke&#40;StandardContextValve.java&#58;178&#41;
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke&#40;CustomPrincipalValve.java&#58;39&#41;
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke&#40;SecurityAssociationValve.java&#58;147&#41;
at org.jboss.web.tomcat.security.JaccContextValve.invoke&#40;JaccContextValve.java&#58;53&#41;
at org.apache.catalina.core.StandardHostValve.invoke&#40;StandardHostValve.java&#58;126&#41;
at org.apache.catalina.valves.ErrorReportValve.invoke&#40;ErrorReportValve.java&#58;105&#41;
at org.apache.catalina.core.StandardEngineValve.invoke&#40;StandardEngineValve.java&#58;107&#41;
at org.apache.catalina.connector.CoyoteAdapter.service&#40;CoyoteAdapter.java&#58;148&#41;
at org.apache.coyote.http11.Http11Processor.process&#40;Http11Processor.java&#58;825&#41;
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection&#40;Http11Protocol.java&#58;743&#41;
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket&#40;PoolTcpEndpoint.java&#58;527&#41;
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run&#40;MasterSlaveWorkerThread.java&#58;112&#41;
at java.lang.Thread.run&#40;Thread.java&#58;595&#41;

The error occurs when I use the service employeeService and the method ListOfEmployee(). It's only at runtime that the problem occurs.
When the server start and the project is loaded in the server all seems good.

When i look at the error, it's seems that the hibernate definition is "not load" or is not in the context. The corresponding sql generate is "select from. But when I look in the start of the server the context seems well initalised. It 's seem to be an configuration error but i don't have any idea.

To be complete the hibernate config file and the startup of the server: