reset password
Author Message
ummata
Posts: 68
Posted 05:58 Oct 29, 2011 |

Hi all,

Every time I have table name 'criterions' in my script, I will get this error after running TestSuite.

Tests run: 66, Failures: 2, Errors: 0, Skipped: 64, Time elapsed: 8.086 sec <<< FAILURE!
Failed tests:   init(csns.test.Setup): org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [-- DB Creation Script for CSNS cleanup(csns.test.Setup): StatementCallback; bad SQL grammar [

At first, I used SQL script generated by Hibernate to modify "csns2-create.sql" and I got an error.
So I modified them to standard SQL, I still got the same error.

Then I tried delete all my new java files and SQL(create and drop) and wrote a simple 'create table' with only two fields to the script. And I tried different table names to see if tests fail or not.
It turns out that all table name is valid(No failed tests) excepts table name 'criterions'.

Anything wrong with an IDE or Hibernate?
Last edited by ummata at 06:00 Oct 29, 2011.
cysun
Posts: 2935
Posted 22:54 Oct 29, 2011 |

You should read error messages more carefully, which usually would tell you exactly what went wrong. Don't try to fix an error before you understand what the error is.

In this case, you probably had an ceriterions table in the database that you forgot to drop.

aaronyen
Posts: 29
Posted 20:46 Oct 31, 2011 |

Today I tried to run the csns2 maven project but I've encountered this error:

...

SEVERE: Servlet.service() for servlet [csns2] in context with path [/csns2] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query] with root cause
org.postgresql.util.PSQLException: ERROR: relation "news" does not exist

...


And the following on the browser:

...

HTTP Status 500 -


type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

...

I checked out the example csns2 code under a new project name without any other changes but I still get the same error.

I can run other projects such as Rubric and Review fine.  I am using Tomcat 7.0.12..

I've also double checked that my username and password for database are correct.

I've also removed and added Tomcat again but still doesn't work.

Can anyone help me fix this?  Thank you.

Last edited by aaronyen at 21:27 Oct 31, 2011.
cysun
Posts: 2935
Posted 08:36 Nov 01, 2011 |

ERROR: relation "news" does not exist