gpt4 book ai didi

java - org.h2.jdbc.JdbcSQL异常 : Table "ALL_SEQUENCES" not found

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:44:40 25 4
gpt4 key购买 nike

谁能告诉我以下错误的原因。

我在我的项目中使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com