Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLGrammarException with PostgreSQL when searching subscribers #47

Open
GoogleCodeExporter opened this issue Mar 30, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Search the subscribers of a list

What is the expected output? What do you see instead?

javax.ejb.EJBException: javax.persistence.PersistenceException: 
org.hibernate.exception.SQLGrammarException: could not execute query
    at com.caucho.ejb.util.XAManager.rethrowEjbException(XAManager.java:353)
    at org.subethamail.core.lists.ListMgrBean__ListMgrStatelessProxy.searchSubscribers(ListMgrBean__ListMgrStatelessProxy.java:2683)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:302)
    at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:198)
    at com.caucho.hessian.server.HessianServlet.invoke(HessianServlet.java:399)
    at com.caucho.hessian.server.HessianServlet.service(HessianServlet.java:379)
    at com.caucho.server.dispatch.WebServiceFilterChain.doFilter(WebServiceFilterChain.java:101)
    at org.subethamail.web.servlet.ListFilter.doFilter(ListFilter.java:128)
    at org.subethamail.web.util.AbstractFilter.doFilter(AbstractFilter.java:53)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at org.subethamail.web.util.SetRequestCharsetFilter.doFilter(SetRequestCharsetFilter.java:41)
    at org.subethamail.web.util.AbstractFilter.doFilter(AbstractFilter.java:53)
    at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
    at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:287)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:802)
    at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:731)
    at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:693)
    at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:677)
    at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:623)
    at com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:107)
    at com.caucho.network.listen.ConnectionReadTask.runThread(ConnectionReadTask.java:98)
    at com.caucho.network.listen.ConnectionReadTask.run(ConnectionReadTask.java:81)
    at com.caucho.network.listen.AcceptTask.run(AcceptTask.java:65)
    at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
    at com.caucho.env.thread.ResinThread.run(ResinThread.java:130)
Caused by: javax.persistence.PersistenceException: 
org.hibernate.exception.SQLGrammarException: could not execute query
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1235)
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1168)
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:250)
    at org.subethamail.core.util.SubEthaEntityManager.findSubscribers(SubEthaEntityManager.java:521)
    at org.subethamail.core.lists.ListMgrBean.searchSubscribers(ListMgrBean.java:718)
    at org.subethamail.core.lists.ListMgrBean__ListMgrStatelessProxy.searchSubscribers(ListMgrBean__ListMgrStatelessProxy.java:2653)
    ... 29 more
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.loader.Loader.doList(Loader.java:2297)
    at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2204)
    at org.hibernate.loader.Loader.list(Loader.java:2164)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:448)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241)
    ... 32 more
Caused by: org.postgresql.util.PSQLException: ERROR: for SELECT DISTINCT, ORDER 
BY expressions must appear in select list
 Position: 519
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
    at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection$StatementHandler.invoke(AbstractJdbc23PooledConnection.java:455)
    at $Proxy92.executeQuery(Unknown Source)
    at com.caucho.sql.UserPreparedStatement.executeQuery(UserPreparedStatement.java:108)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1849)
    at org.hibernate.loader.Loader.doQuery(Loader.java:718)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
    at org.hibernate.loader.Loader.doList(Loader.java:2294)
    ... 40 more

Original issue reported on code.google.com by gilberthuph@gmail.com on 29 Jun 2011 at 4:37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant