@CreatedDate annotation does not work with mysql

后端 未结 2 399
清酒与你
清酒与你 2021-01-04 02:54

I am new to spring and I am confused how @CreatedDate annotation works in an entity.

I did a google search and there were many solutions, but none of them worked fo

2条回答
  •  梦谈多话
    2021-01-04 03:29

    I was Having this issue also and your solution helped me, Thanks, And I add some other annotations to work

    Fist make sure you put in SpringApplication Configuration

    @SpringBootApplication
    @EnableJpaAuditing
    

    Second, make sure you use this annotation on your needed entities

      @Entity
      @Table
      @EntityListeners(AuditingEntityListener.class)
    

提交回复
热议问题