postgresql Hibernate“无法执行查询”异常!
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1317739/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Hibernate "could not execute query" Exception!
提问by Winston Chen
exception
javax.servlet.ServletException: org.hibernate.exception.GenericJDBCException: could not execute query
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
org.hibernate.exception.GenericJDBCException: could not execute query
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.doList(Loader.java:2153)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
org.hibernate.loader.Loader.list(Loader.java:2024)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:300)
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1127)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
org.cosmosociety.actions.BlogAction.execute(BlogAction.java:35)
My environment is postgre + tomcat + hibernate 3 + struts 1.x. I am going to take a look at hibernate 3 source code later. I will update everybody if I find the solution.
我的环境是postgre + tomcat + hibernate 3 + struts 1.x。稍后我将查看 hibernate 3 源代码。如果我找到解决方案,我会更新所有人。
回答by David Rabinowitz
Have you checked your permissions? If it is working locally and not on your hosting, you may have credentials issue.
你检查过你的权限吗?如果它在本地运行而不是在您的主机上运行,则您可能有凭据问题。
回答by Jens Schauder
Check for the differences between the 'hosting server' and your local machine.
检查“托管服务器”和您的本地机器之间的差异。
Especially do a diff on the two schemas
特别是在两个模式上做一个差异
For further debugging:
进一步调试:
Activate SQL-Logging, so you get the offending sql-statement. If you can't do it globally do it programmatically before the command causing the exception and deactivate it afterwards.
Execute the sql statement on your machine and on the 'hosting server'
Assuming you get an exception on the hosting server, but still don't see the reason, simplify the sql statement step by step, until you find the problematic piece, which in turn should identify the problem pretty well.
激活 SQL-Logging,这样你就会得到有问题的 sql 语句。如果您无法全局执行此操作,请在导致异常的命令之前以编程方式执行此操作,然后再将其停用。
在您的机器和“托管服务器”上执行 sql 语句
假设您在托管服务器上遇到异常,但仍然没有看到原因,请逐步简化sql语句,直到找到有问题的部分,这反过来应该可以很好地识别问题。
回答by SubbaReddy
what your writing query you not placed here?
什么你的写作查询你没有放在这里?
In before i am also getting the same type of error by using the hibernate.
在之前,我也通过使用 hibernate 得到了相同类型的错误。
In my application i am doing some mistake like my table column name i am giving wrong.
在我的应用程序中,我犯了一些错误,例如我给错的表列名。
When i am correcting the table column name that all are displayed successfully.
当我更正所有显示成功的表列名称时。
you also check your all column names in dbtable and your giving property names in java classes.
您还可以检查 dbtable 中的所有列名以及 Java 类中的属性名称。