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 1313import org .hibernate .annotations .Generated ;
1414import org .hibernate .cfg .AvailableSettings ;
1515
16+ import org .hibernate .community .dialect .InformixDialect ;
1617import org .hibernate .testing .orm .junit .DomainModel ;
1718import org .hibernate .testing .orm .junit .ServiceRegistry ;
1819import org .hibernate .testing .orm .junit .SessionFactory ;
@@ -82,7 +83,7 @@ public void testUpdate(SessionFactoryScope scope) {
8283 entities .forEach ( ge -> ge .setName ( "updated" ) );
8384
8485 //We need to wait a little to make sure the timestamps produced are different
85- waitALittle ();
86+ waitALittle ( scope );
8687 session .flush (); // force update and retrieval of generated values
8788
8889 entities .forEach ( ge -> assertThat ( ge .getName () ).isEqualTo ( "updated" ) );
@@ -129,9 +130,13 @@ public Instant getUpdateTimestamp() {
129130 }
130131 }
131132
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 ;
133138 try {
134- Thread .sleep ( 10 );
139+ Thread .sleep ( waitLonger ? 1_200 : 10 );
135140 }
136141 catch (InterruptedException e ) {
137142 throw new HibernateError ( "Unexpected wakeup from test sleep" );
Original file line number Diff line number Diff line change 99import java .util .List ;
1010import java .util .Locale ;
1111
12+ import org .hibernate .HibernateError ;
1213import org .hibernate .annotations .CurrentTimestamp ;
1314
15+ import org .hibernate .community .dialect .InformixDialect ;
1416import org .hibernate .testing .jdbc .SQLStatementInspector ;
1517import org .hibernate .testing .orm .junit .DomainModel ;
1618import org .hibernate .testing .orm .junit .Jira ;
@@ -77,6 +79,8 @@ public void testUpdate(SessionFactoryScope scope) {
7779 assertThat ( pizza .getLastUpdated () ).isEqualTo ( updatedTime );
7880 } );
7981
82+ waitALittle ( scope );
83+
8084 scope .inTransaction ( session -> {
8185 final Pizza pizza = session .find ( Pizza .class , 1L );
8286 assertThat ( pizza .getToppings () ).hasSize ( 3 )
@@ -177,4 +181,17 @@ public void setPizza(final Pizza pizza) {
177181 }
178182
179183 }
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+ }
180197}
You can’t perform that action at this time.
0 commit comments