How to store timestamp in h2 database
<p>I have a simple REST Api exposing several entities, some of which, has date field which I would like to store in a H2 database in the UNIX timestamp format. However, this is causing the followign exceptions:</p>

<pre><code>Caused by: org.h2.jdbc.JdbcSQLException: Cannot parse "TIMESTAMP" constant "335923000"; SQL statement:
INSERT INTO people (person_id, first_name, last_name, email, gender, location, date_birth) VALUES 
    ('1', 'Peter', 'Smith', 'peter@hotmail.com', 'MALE', 'London', 335923000),
    ...
</code></pre>

<p>Previously, it worked with timestamp in the following format: <code>'1980-04-08'</code>.</p>

<p>This is the SQL table definition:</p>

<pre><code>CREATE TABLE people (
    person_id BIGINT PRIMARY KEY auto_increment,
    first_name VARCHAR(32),
    last_name VARCHAR(32),
    email VARCHAR(128) UNIQUE,
    gender VARCHAR(8),
    location VARCHAR(32),
    date_birth TIMESTAMP,
);
</code></pre>

<p>and my mapping object (unnecessary details omitted):</p>

<pre><code>@Entity
@Table(name = "people")
@Getter
@Setter
public class Person {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "person_id")
    private long id;

    ...

    @Column(name = "date_birth")
    @JsonFormat(pattern = "YYYY-MM-dd")
    private Date dateOfBirth;

    ...
}
</code></pre>

<p>I assume the the <code>@JsonFormat</code> annotation does not have anything to do with the database timestamp format but I am not sure how to tell hibernate that my timestamp are in UNIX format.</p>

<p>I have looked at <a href="https://stackoverflow.com/questions/16012138/convert-unix-timestamp-to-h2-timestamp">convert unix timestamp to H2 timestamp</a> and H2 docs and this standard format should be supported. Could someone point out to me, what am I doing wrong?</p>