Tom
Tom

Reputation: 287

Store millisecond value using hibernate @CreationTimestamp annotation

I am using the following code in my entity

@CreationTimestamp
private LocalDateTime responseDateTime;

This is working fine, however is storing the date in format 2021-02-15 21:26:39. How can I get this date to store with a millisecond value?

Thanks

Upvotes: 0

Views: 1115

Answers (1)

Daniel
Daniel

Reputation: 680

I think that issue is mostly related to the actual type of column in your database. Looks like it would be better to use DATETIME(3) type - as it allows to have fractional second information.
More information can be found at MySQL Reference Manual

Upvotes: 1

Related Questions