'Can i use @CreationTimestamp on an @Embeddable pojo?

Can i use @CreationTimestamp on an @Embeddable pojo? I've noticed that the date remains null after adding this class:

@Embeddable
public class LaborPeriodChange implements Serializable {

    //@PrePersist

    @Temporal(TemporalType.TIMESTAMP)
    @Column(updatable = false)
    @CreationTimestamp
    private Date dateChanged;

to the elementcollection in LaborPeriod.

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

So can @CreationTimestamp only be used on @Entity pojo's?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source