H2 数据库错误:“未找到域 'int'”

问题描述 投票:0回答:1
@Column(name = "trust", length = 1, nullable = false, columnDefinition = "int")
private Boolean trust;

org.h2.jdbc.JdbcSQLSyntaxErrorException:未找到域“int”;

我认为问题出在数据类型规范上。我应该如何在H2(版本:2.1.214)中正确定义这些列以进行积分测试?我也在使用 MariaDB,因此任何有关两个数据库之间兼容性的建议都会有所帮助。

提前致谢!

java spring-boot hibernate mariadb h2
1个回答
0
投票

H2 数据类型:https://www.h2database.com/html/datatypes.html
MariaDB 数据类型:https://mariadb.com/kb/en/data-types/

由于H2不支持“int”类型,请使用“integer”(相当于MariaDB中的“int”)。
而且,实际使用的列是布尔型的,所以最好以相同的类型定义列。

© www.soinside.com 2019 - 2024. All rights reserved.