I want my entity to have a modification timestamp whenever it is updated. mysql
supports this using the following definition:
@Entity
public class MyTable {
@Column(columnDefinition = "TIMESTAMP default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP")
private LocalDateTime thetime;
}
Problem: in my JUnit
tests I want to use an embedded inmemory H2
database. And H2 does not support on update CURRENT_TIMESTAMP
.
Question: how can I keep the column definition (as I will be running mysql in all cases except in automated tests)? And how can I workaround that in my h2 testing?