title: How to save TimeStamp in single column using hibernate
body: <p>How do I save timestamps in mysql DB using a hibernate entity in specific format.</p>
  <p>Hibernate Entity Class:</p>
  <pre><code>@CreationTimestamp
  @Column(name=&quot;created_on&quot;, nullable = false, updatable = false)
  private LocalDateTime createdOn;
  
  @UpdateTimestamp
  @Column(name=&quot;updated_on&quot;, nullable = false)
  private LocalDateTime updatedOn; // = DateTimeFormatter.ofPattern(&quot;yyyy-MM-dd HH:mm:ss&quot;);
  </code></pre>
  <p>I have also used DateTimeFormatter and SimpleDateFormat but they all gave the same error:</p>
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unsupported property type [java.time.format.DateTimeFormatter] for @CreationTimestamp or @UpdateTimestamp generator annotation
  </code></pre>
  <p>application.properties:</p>
  <pre><code>spring.jpa.hibernate.ddl-auto=update
  </code></pre>