diff --git a/ebean-api/src/main/java/io/ebean/config/dbplatform/h2/H2HistoryTrigger.java b/ebean-api/src/main/java/io/ebean/config/dbplatform/h2/H2HistoryTrigger.java index fc7aeebdd..2867ca06c 100644 --- a/ebean-api/src/main/java/io/ebean/config/dbplatform/h2/H2HistoryTrigger.java +++ b/ebean-api/src/main/java/io/ebean/config/dbplatform/h2/H2HistoryTrigger.java @@ -76,13 +76,7 @@ public class H2HistoryTrigger implements Trigger { public void fire(Connection connection, Object[] oldRow, Object[] newRow) throws SQLException { if (oldRow != null) { // a delete or update event - long nowMillis = System.currentTimeMillis(); - Timestamp lastStart = (Timestamp) oldRow[effectStartPosition]; - if (lastStart != null && lastStart.getTime() >= nowMillis) { - nowMillis = lastStart.getTime() + 1; - } - - Timestamp now = new Timestamp(nowMillis); + Timestamp now = new Timestamp(System.currentTimeMillis()); oldRow[effectEndPosition] = now; if (newRow != null) { // update event. Set the effective start timestamp to now. diff --git a/ebean-test/src/test/java/io/ebeaninternal/dbmigration/DbMigrationTest.java b/ebean-test/src/test/java/io/ebeaninternal/dbmigration/DbMigrationTest.java index 46841897e..17736c17d 100644 --- a/ebean-test/src/test/java/io/ebeaninternal/dbmigration/DbMigrationTest.java +++ b/ebean-test/src/test/java/io/ebeaninternal/dbmigration/DbMigrationTest.java @@ -213,6 +213,11 @@ public class DbMigrationTest extends BaseTestCase { hist2.setTestString2("bar1"); hist2.setTestString3("baz1"); tmpServer.save(hist2); + try { + Thread.sleep(1); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } hist2.setTestString("foo2"); hist2.setTestString2("bar2"); tmpServer.save(hist2);