2

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.

CodeDCode
  • 390
  • 5
  • 17
  • Read http://stackoverflow.com/questions/30707621/spring-jpa-default-value-for-enum-field-in-enum/30707816#30707816 – JB Nizet Jun 12 '15 at 15:23
  • This is not helping its for mysql and I need something for Oracle system date using current_date function – CodeDCode Jun 22 '15 at 16:14
  • Re-read it to understand what you're doing, and why your solution is not the right solution. Whether you use Oracle or MySQL is irrelevant – JB Nizet Jun 22 '15 at 16:17

1 Answers1

1

You can use

updatable= false
@Column(name="TMSP", updatable= false, columnDefinition="TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable=false)
private Timestamp tmsp;
George Netu
  • 2,758
  • 4
  • 28
  • 49