The default value and modify the default value of Boolean and boolean in Java

Defaults

boolean is the basic data type of Java, the default value is false;
Boolean is a class of Java, the default value is null

Recommended use

insert image description here
According to the Alibaba Development Manual, it is recommended to use Boolean as the Boolean data type in the field.
Then, if you need to modify the default value of Boolean, you can refer to the following method:

@Colum(columDefinition = "Boolean defalut '1'")
private Boolean fineOrNo

When initialized in this way, the default value of this field in the database is 1, which is true.

Guess you like

Origin blog.csdn.net/qq_28545605/article/details/125969598