Skip to content

Commit 279a206

Browse files
committed
Misc fixes for timestamp related intermittent test failures
1 parent 15f3ef2 commit 279a206

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metadata/Record.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ public class Record {
2525
@Id @GeneratedValue
2626
String id;
2727
String text;
28-
LocalDateTime timestamp = LocalDateTime.now();
28+
LocalDateTime timestamp;
2929
Record() {}
30-
public Record(String text) {
30+
public Record(String text, LocalDateTime timestamp) {
3131
this.text = text;
32+
this.timestamp = timestamp;
3233
}
3334
}

hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metadata/TypesafeNamedQueryTest.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,21 @@
44
*/
55
package org.hibernate.orm.test.jpa.metadata;
66

7-
import org.hibernate.community.dialect.FirebirdDialect;
8-
import org.hibernate.community.dialect.InformixDialect;
9-
import org.hibernate.dialect.SybaseASEDialect;
107
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
118
import org.hibernate.testing.orm.junit.Jpa;
12-
import org.hibernate.testing.orm.junit.SkipForDialect;
139
import org.junit.jupiter.api.Test;
1410

11+
import java.time.LocalDate;
1512
import java.util.List;
1613

1714
import static org.junit.jupiter.api.Assertions.assertEquals;
1815

1916
@Jpa(annotatedClasses = Record.class)
2017
public class TypesafeNamedQueryTest {
21-
@SkipForDialect(dialectClass = SybaseASEDialect.class, reason = "'order by timestamp, id' not quite working")
22-
@SkipForDialect(dialectClass = FirebirdDialect.class, reason = "'order by timestamp, id' not quite working")
23-
@SkipForDialect(dialectClass = InformixDialect.class, reason = "'order by timestamp, id' not quite working")
2418
@Test void test(EntityManagerFactoryScope scope) {
2519
scope.inTransaction( entityManager -> {
26-
Record record1 = new Record("Hello, World!");
27-
Record record2 = new Record("Goodbye!");
20+
Record record1 = new Record("Hello, World!", LocalDate.EPOCH.atStartOfDay());
21+
Record record2 = new Record("Goodbye!", LocalDate.EPOCH.atStartOfDay().plusSeconds( 1L ));
2822
entityManager.persist(record1);
2923
entityManager.persist(record2);
3024
String text = entityManager.createQuery(Record_._TextById_).setParameter(1, record1.id).getSingleResult();

0 commit comments

Comments
 (0)