作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
谁能告诉我以下错误的原因。
我在我的项目中使用 Hibernate 并在服务器启动期间遇到以下错误
15:04:27.909 [localhost-startStop-1] ERROR o.h.tool.hbm2ddl.SchemaValidator - HHH000319: Could not get database metadata
org.h2.jdbc.JdbcSQLException: Table "ALL_SEQUENCES" not found; SQL statement:
select sequence_name from all_sequences union select synonym_name from all_synonyms us, all_sequences asq where asq.sequence_name = us.table_name and asq.sequence_owner = us.table_owner [42102-168]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) ~[h2-1.3.168.jar:1.3.168]
at org.h2.message.DbException.get(DbException.java:169) ~[h2-1.3.168.jar:1.3.168]
at org.h2.message.DbException.get(DbException.java:146) ~[h2-1.3.168.jar:1.3.168]
at org.h2.command.Parser.readTableOrView(Parser.java:4770) ~[h2-1.3.168.jar:1.3.168]
at org.h2.command.Parser.readTableFilter(Parser.java:1084) ~[h2-1.3.168.jar:1.3.168]
at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1690) ~[h2-1.3.168.jar:1.3.168]
最佳答案
当您在 persistence.xml
中的 persistence-unit
中使用错误的方言,或者您针对错误的数据库进行验证时,就会发生这种情况。例如,当您针对本地 H2 数据库运行应用程序时,最好的选择是删除方言,因为 Hibernate 可以在没有此属性的情况下识别数据库(如果 Hibernate 的版本足够新以识别更新的数据库)。另一种解决方案是删除验证属性,但我不建议这样做,因为您在启动时没有数据库检查:
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.hbm2ddl.auto" value="validate" />
</properties>
关于java - org.h2.jdbc.JdbcSQL异常 : Table "ALL_SEQUENCES" not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38744825/
我无法查询数据库中的“all_sequences”表。 我是否需要向所有者/用户 ID 提供任何授权才能解决此问题? 由于这个问题,在服务器启动期间,我从 hibernate.hbm2ddl.auto
谁能告诉我以下错误的原因。 我在我的项目中使用 Hibernate 并在服务器启动期间遇到以下错误 15:04:27.909 [localhost-startStop-1] ERROR o.h.too
我尝试将 H2 用于测试目的添加到 Spring Boot application-test.yml ,我的生产数据库是Oracle。我想通过 liquibase 填充 H2 模式,但收到以下错误:
我是一名优秀的程序员,十分优秀!