如果在域 class 中声明,hibernate 是否可以在 db 中创建具有默认值的列?

is it possible for hibernate to create a column in db with default value if it is declared in the domain class?

我需要在数据库中为 table(超过 500 万行)中的所有记录添加一个值为 false 的列。我已经在域 class 中声明了该列:boolean isLocked,但是当应用程序启动时,我收到此异常: Caused by: org.postgresql.util.PSQLException: ERROR: column isLocked does not exist.

我想知道是否可以让 hibernate 使用默认值(布尔值为 false)只创建一次此列。

我使用的是 grails 3.3.9 版本。

我最终所做的是在数据库中手动创建列,因此在启动应用程序时,它会看到该列存在于数据库中。