Now when I was in new users, through the save method adds a data repository, set the initial value to some fields, and entity class with the @ DynamicInsert annotations,
When I save to the database found that those who were not initialize the fields is not the default value of the database table, but the default value of Java data types, such as the level field, the database limit hi is: int the not null default level 1 and then through the debug found a value of 0
CodePudding user response:
@ DynamicInsert will keep not null field when generating SQL, pay attention to use the wrapper class basic types, for example, if you say that the level of the field, if a class is used in the int instead of an Integer, a default value of 0, not null