0

我得到以下错误:org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66 ) 在 org.hibernate.loader.Loader.doList(Loader.java:2231) 在 org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125) 在 org.hibernate.loader.Loader.list(Loader.java: 2120) 在 org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401) 在 org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361) 在 org.hibernate.engine.query.HQLQueryPlan .performList(HQLQueryPlan.java:196) 在 org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148) 在 org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) 在 database.dao.UserDAO。getCustomerById(UserDAO.java:73) at database.dao.UserDAO.main(UserDAO.java:15) 原因:java.sql.SQLSyntaxErrorException:用户缺少权限或找不到对象:org.hsqldb.jdbc.JDBCUtil 的 USERREGISTRATIONBEAN。 org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCPreparedStatement.(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source) at org.hibernate 的 sqlException(Unknown Source) .jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534) 在 org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452) 在 org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) 在 org. hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573) at org.hibernate.loader.Loader.doQuery(Loader.java:696) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.doList(Loader.java:2228) ... 9 更多原因:org.hsqldb.HsqlException:用户缺少权限或对象未找到: org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.SchemaManager.getTable(Unknown Source) at org.hsqldb.ParserDQL 的 USERREGISTRATIONBEAN .readTableName(Unknown Source) at org.hsqldb.ParserDQL.readTableOrSubquery(Unknown Source) at org.hsqldb.ParserDQL.XreadTableReference(Unknown Source) at org.hsqldb.ParserDQL.XreadFromClause(Unknown Source) at org.hsqldb.ParserDQL.XreadTableExpression (未知来源)在 org.hsqldb.ParserDQL.XreadQuerySpecification(未知来源)在 org.hsqldb.ParserDQL。XreadSimpleTable(Unknown Source) at org.hsqldb.ParserDQL.XreadQueryPrimary(Unknown Source) at org.hsqldb.ParserDQL.XreadQueryTerm(Unknown Source) at org.hsqldb.ParserDQL.XreadQueryExpressionBody(Unknown Source) at org.hsqldb.ParserDQL.XreadQueryExpression( Unknown Source) at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source) at org.hsqldb.ParserCommand.compilePart(Unknown Source) at org.hsqldb.ParserCommand.compileStatement(Unknown Source) at org.hsqldb.Session.compileStatement(Unknown Source ) 在 org.hsqldb.StatementManager.compile(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) ... 还有 18 个XreadQueryExpressionBody(Unknown Source) at org.hsqldb.ParserDQL.XreadQueryExpression(Unknown Source) at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source) at org.hsqldb.ParserCommand.compilePart(Unknown Source) at org.hsqldb.ParserCommand.compileStatement( Unknown Source) at org.hsqldb.Session.compileStatement(Unknown Source) at org.hsqldb.StatementManager.compile(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) ... 还有 18 个XreadQueryExpressionBody(Unknown Source) at org.hsqldb.ParserDQL.XreadQueryExpression(Unknown Source) at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source) at org.hsqldb.ParserCommand.compilePart(Unknown Source) at org.hsqldb.ParserCommand.compileStatement( Unknown Source) at org.hsqldb.Session.compileStatement(Unknown Source) at org.hsqldb.StatementManager.compile(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) ... 还有 18 个在 org.hsqldb.Session.execute(Unknown Source) 处编译(Unknown Source) ... 18 更多在 org.hsqldb.Session.execute(Unknown Source) 处编译(Unknown Source) ... 18 更多

我的创建表语句如下: CREATE TABLE UserRegistrationBean( id integer 默认生成为 identity NOT NULL, user_name varchar(20) NOT NULL, password varchar(20) NOT NULL, email varchar(45) NOT NULL, securityQuestion varchar(50) NOT NULL, securityAnswer varchar(50) NOT NULL, PRIMARY KEY (id) ) ;

请提出建议,因为我在互联网上找不到任何可以解决的问题。

4

1 回答 1

0

该错误意味着您的 CREATE TABLE 语句未在您的数据库上执行。如果您关闭内存数据库,然后尝试将其插入,则可能会发生这种情况。

尽管与此问题无关,但请使用 HSQLDB 的最新发布版本,而不是快照版本。

于 2013-09-07T23:59:29.187 回答