(1) Why is the "@CreationTimestamp" field updated to null for a "save" called on the repository with a null value for that field? I expect that a field annotated with "@CreationTimestamp" is never updated and maintained only once at the time of creation. But it does not work that way in my current project.
(2) I had to include @Column(updatable =false) (in addition to @CreationTimestamp annotation). Why is this necessary?
It's 2020, hibernate-core-5.3.12, and still need to set updatable to false.
@CreationTimestamp @Column(updatable = false) private LocalDateTime createdDate;
Update
I believe there will be no fix for this because this CreationTimestamp
is from native hibernate package (org.hibernate.annotations
), and I believe the efforts will be on the jpa abstraction (org.springframework.data.annotation.CreatedBy
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With