File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/mapping/generated Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 13
13
import org .hibernate .annotations .Generated ;
14
14
import org .hibernate .cfg .AvailableSettings ;
15
15
16
+ import org .hibernate .community .dialect .InformixDialect ;
16
17
import org .hibernate .testing .orm .junit .DomainModel ;
17
18
import org .hibernate .testing .orm .junit .ServiceRegistry ;
18
19
import org .hibernate .testing .orm .junit .SessionFactory ;
@@ -82,7 +83,7 @@ public void testUpdate(SessionFactoryScope scope) {
82
83
entities .forEach ( ge -> ge .setName ( "updated" ) );
83
84
84
85
//We need to wait a little to make sure the timestamps produced are different
85
- waitALittle ();
86
+ waitALittle ( scope );
86
87
session .flush (); // force update and retrieval of generated values
87
88
88
89
entities .forEach ( ge -> assertThat ( ge .getName () ).isEqualTo ( "updated" ) );
@@ -129,9 +130,13 @@ public Instant getUpdateTimestamp() {
129
130
}
130
131
}
131
132
132
- private static void waitALittle () {
133
+ private static void waitALittle (SessionFactoryScope scope ) {
134
+ boolean waitLonger =
135
+ // informix clock has low resolution on Mac
136
+ scope .getSessionFactory ().getJdbcServices ().getDialect ()
137
+ instanceof InformixDialect ;
133
138
try {
134
- Thread .sleep ( 10 );
139
+ Thread .sleep ( waitLonger ? 1_200 : 10 );
135
140
}
136
141
catch (InterruptedException e ) {
137
142
throw new HibernateError ( "Unexpected wakeup from test sleep" );
Original file line number Diff line number Diff line change 9
9
import java .util .List ;
10
10
import java .util .Locale ;
11
11
12
+ import org .hibernate .HibernateError ;
12
13
import org .hibernate .annotations .CurrentTimestamp ;
13
14
15
+ import org .hibernate .community .dialect .InformixDialect ;
14
16
import org .hibernate .testing .jdbc .SQLStatementInspector ;
15
17
import org .hibernate .testing .orm .junit .DomainModel ;
16
18
import org .hibernate .testing .orm .junit .Jira ;
@@ -77,6 +79,8 @@ public void testUpdate(SessionFactoryScope scope) {
77
79
assertThat ( pizza .getLastUpdated () ).isEqualTo ( updatedTime );
78
80
} );
79
81
82
+ waitALittle ( scope );
83
+
80
84
scope .inTransaction ( session -> {
81
85
final Pizza pizza = session .find ( Pizza .class , 1L );
82
86
assertThat ( pizza .getToppings () ).hasSize ( 3 )
@@ -177,4 +181,17 @@ public void setPizza(final Pizza pizza) {
177
181
}
178
182
179
183
}
184
+
185
+ private static void waitALittle (SessionFactoryScope scope ) {
186
+ boolean waitLonger =
187
+ // informix clock has low resolution on Mac
188
+ scope .getSessionFactory ().getJdbcServices ().getDialect ()
189
+ instanceof InformixDialect ;
190
+ try {
191
+ Thread .sleep ( waitLonger ? 1_200 : 2 );
192
+ }
193
+ catch (InterruptedException e ) {
194
+ throw new HibernateError ( "Unexpected wakeup from test sleep" );
195
+ }
196
+ }
180
197
}
You can’t perform that action at this time.
0 commit comments