set Oracle Current Timestamp to JPA entity

1.6k views Asked by At

I Have simple question,

I want to set Oracle CURRENT_TIMESTAMP to my JPA entity, I do not want Java to send value.

I tried below but did not work.

@Column(name="TMSP", columnDefinition="TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable=false)
private Timestamp tmsp;

its either inserting null or date I set in java but not the DB date.

1

There are 1 answers

0
Saranya Ganesan On

You can use

updatable= false
@Column(name="TMSP", updatable= false, columnDefinition="TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable=false)
private Timestamp tmsp;