Skip to content

Commit cebfe78

Browse files
committed
Misc fixes for timestamp related intermittent test failures
1 parent 90e1634 commit cebfe78

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-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();

hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryShadowingTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
import jakarta.persistence.Entity;
88
import jakarta.persistence.GeneratedValue;
99
import jakarta.persistence.Id;
10+
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
1011
import org.hibernate.testing.orm.junit.DomainModel;
1112
import org.hibernate.testing.orm.junit.Jira;
13+
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
1214
import org.hibernate.testing.orm.junit.SessionFactory;
1315
import org.hibernate.testing.orm.junit.SessionFactoryScope;
1416
import org.junit.jupiter.api.Test;
@@ -23,6 +25,7 @@
2325
public class SubQueryShadowingTest {
2426

2527
@Test
28+
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsOffsetInSubquery.class, comment = "The check is for both, limit and offset in subqueries")
2629
@Jira("https://hibernate.atlassian.net/browse/HHH-19745")
2730
public void testSelectCase(SessionFactoryScope scope) {
2831
scope.inTransaction( session -> {

0 commit comments

Comments
 (0)