简体   繁体   中英

JPA & Flyway boolean type in Oracle

I use Flyway and Spring JPA for creating tables and persistence. The approach below works well for H2 embedded database (set in oracle compatibility mode). But I noticed it creates the boolean field still as a "boolean" in database, which is not supported in Oracle.

So my question is is this still going to work when I start using a real Oracle database? that flyway will detect the database type and before creation map the boolean to a Number(1) or so?

In the flyway script:

Create table Account{
    ...
    USER_EXISTS BOOLEAN not null,
    ....
}

And in the Account Entity class:

    private Boolean usertExists = true;

对数据类型使用Flyway占位符,对于H2环境,将该值设置为BOOLEAN ;对于Oracle环境,将该值设置为Number(1)

Create table Account{ ... USER_EXISTS ${boolean_datatype} not null, .... }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM