views:

481

answers:

1

Hey Guys

We're using hibernate entitymanager to map our entities through JPA. And we are using HSQLDB in-memory database for unit testing. Everything was fine until a recent refactor to the model started causing the following error:

17:55:48.516 [main] WARN  o.h.util.JDBCExceptionReporter - SQL Error: -22, SQLState: S0002
17:55:48.517 [main] ERROR o.h.util.JDBCExceptionReporter - Table not found in statement

I can't post the SQL in question, but can anyone give me pointers as to the possible causes of the above error? especially since I know the code was working before. It seems like hibernate is generating invalid sqls because of the refactor?

+1  A: 

Well, is the table actually there? Enable SQL output for Hibernate and check it against the actual database schema.

Your refactoring may have been botched (entity and table were renamed; named query was not updated).

Or you may have an older class(es) somewhere in classpath causing wrong annotations to be read.

ChssPly76
Turns out an entity was named to a reserved word, causing table creation to fail.
shipmaster
reserved word - I had the same problem !
Maciek Kreft