Oracle 中的 JPA 和 Flyway 布尔类型
JPA & Flyway boolean type in Oracle
我使用 Flyway 和 Spring JPA 来创建表和持久性。下面的方法适用于 H2 嵌入式数据库(设置为 oracle 兼容模式)。但我注意到它在数据库中创建的布尔字段仍然是 "boolean",这在 Oracle 中不受支持。
所以我的问题是,当我开始使用真正的 Oracle 数据库时,这是否仍然有效?该 flyway 将检测数据库类型,并在创建之前将布尔值映射到 Number(1) 左右?
在flyway脚本中:
Create table Account{
...
USER_EXISTS BOOLEAN not null,
....
}
并且在账户实体 class:
private Boolean usertExists = true;
为数据类型使用 Flyway 占位符,并将 H2 环境的值设置为 BOOLEAN
,Oracle 环境的值设置为 Number(1)
。
Create table Account{
...
USER_EXISTS ${boolean_datatype} not null,
....
}
我使用 Flyway 和 Spring JPA 来创建表和持久性。下面的方法适用于 H2 嵌入式数据库(设置为 oracle 兼容模式)。但我注意到它在数据库中创建的布尔字段仍然是 "boolean",这在 Oracle 中不受支持。
所以我的问题是,当我开始使用真正的 Oracle 数据库时,这是否仍然有效?该 flyway 将检测数据库类型,并在创建之前将布尔值映射到 Number(1) 左右?
在flyway脚本中:
Create table Account{
...
USER_EXISTS BOOLEAN not null,
....
}
并且在账户实体 class:
private Boolean usertExists = true;
为数据类型使用 Flyway 占位符,并将 H2 环境的值设置为 BOOLEAN
,Oracle 环境的值设置为 Number(1)
。
Create table Account{
...
USER_EXISTS ${boolean_datatype} not null,
....
}