我可以在 @Embeddable pojo 上使用 @CreationTimestamp 吗?

Mau*_*ice 6 java hibernate

我可以在 @Embeddable pojo 上使用 @CreationTimestamp 吗?我注意到添加这个类后日期仍然为空:

@Embeddable
Run Code Online (Sandbox Code Playgroud)

公共类 LaborPeriodChange 实现了 Serializable {

//@PrePersist

@Temporal(TemporalType.TIMESTAMP)
@Column(updatable = false)
@CreationTimestamp
private Date dateChanged;
Run Code Online (Sandbox Code Playgroud)

到 LaborPeriod 中的元素集合。

@ElementCollection
@CollectionTable(name="laborPeriod_change", joinColumns=@JoinColumn(name="FK_LaborPeriod"))
@Column(name="laborPeriod_change")
@JsonIgnore
private List<LaborPeriodChange> laborPeriodChanges = new ArrayList<>();
Run Code Online (Sandbox Code Playgroud)

那么@CreationTimestamp 只能用于@Entity pojo 吗?