The default value of SpringBoot Jpa MySql field is CURRENT_TIMESTAMP invalidation

problem description

I created a table in the mysql database, one of which is the CURRENT_TIMESTAMP,
of the default value of the field create_time. I added a new piece of data when I did the hope test in the project. The
project uses the SpringBoot framework to form a print society relationship between jpa and the table and manipulate the table.
after adding new data successfully, I found that the value of create_time is null

Baidu google did not find a way to solve the problem. I"m here to inquire. Thank you!
here are the relevant screenshots

mysql8

Mar.28,2021

create table tablename (
 
    `create_time` timestamp not null default current_timestamp comment '',
 

have encountered the same situation before
if your sql creates the table format correctly,
do not write the createtime and updatetime attributes in your entity class, because once the parameter is passed in, it will be updated to null

/ 0718 noon update
must take the value of two times and implement update automatic update modified as follows (passed the test)
annotate the entity class @ EntityListeners (AuditingEntityListener.class)
annotate the two attributes
@ CreatedDate @ LastModifiedDate
annotate @ EnableJpaAuditing
on your startup class * * application-- test save and update

Menu