We have
@MappedSuperclass
public abstract class AbstractBusinessObject
implements BusinessObject {
@Id
@Column(name = "id")
private String identity;
@CreationTimestamp
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "created_at", nullable = false, updatable = false)
private Date createdAt;
@UpdateTimestamp
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "modified_at", nullable = false)
private Date modifiedAt;
:
which is extended by an AbstractPerson type;
@Entity( name = "person" )
@Inheritance( strategy = InheritanceType.JOINED )
public class AbstractPerson extends AbstractBusinessObject implements Person {
:
which is extended by a Customer type
@Entity
@Table( name = "customer" )
public class CustomerJpa extends AbstractPerson implements Customer {
:
when a field in the Customer type is updated (via a setter), there is no update of the "modifiedAt" time, and it will remain at the createdAt time. The only issued SQL statement for the update is;
17/07/10 18:20:55.309 main DEBUG o.h.SQL: update customer set email=? where id=?
|