HHH-13266 Skip tests that involve timestamps before epoch with MySQL/Mariadb

This commit is contained in:
Yoann Rodière 2019-03-14 15:24:32 +01:00 committed by gbadner
parent 9380520681
commit ccb6a9ab50
8 changed files with 165 additions and 92 deletions

View File

@ -19,6 +19,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -26,6 +27,7 @@ import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.H2Dialect; import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.MariaDB10Dialect;
import org.hibernate.dialect.Oracle8iDialect; import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.PostgreSQL81Dialect; import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
@ -246,6 +248,19 @@ abstract class AbstractJavaTimeTypeTest<T, E> extends BaseCoreFunctionalTestCase
remappingDialectClasses.add( null ); // Always test without remapping remappingDialectClasses.add( null ); // Always test without remapping
} }
public S skippedForDialects(List<Class<?>> dialectClasses, Consumer<S> skippedIfDialectMatchesClasses) {
boolean skip = false;
for ( Class<?> dialectClass : dialectClasses ) {
if ( dialectClass.isInstance( dialect ) ) {
skip = true;
}
}
if ( !skip ) {
skippedIfDialectMatchesClasses.accept( thisAsS() );
}
return thisAsS();
}
@SafeVarargs @SafeVarargs
public final S alsoTestRemappingsWithH2(Class<? extends AbstractRemappingH2Dialect> ... dialectClasses) { public final S alsoTestRemappingsWithH2(Class<? extends AbstractRemappingH2Dialect> ... dialectClasses) {
if ( dialect instanceof H2Dialect ) { if ( dialect instanceof H2Dialect ) {

View File

@ -15,12 +15,16 @@ import java.time.LocalDateTime;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
/** /**
@ -45,18 +49,23 @@ public class InstantTest extends AbstractJavaTimeTypeTest<Instant, InstantTest.E
.add( 2017, 11, 6, 19, 19, 1, 0, ZONE_UTC_MINUS_8 ) .add( 2017, 11, 6, 19, 19, 1, 0, ZONE_UTC_MINUS_8 )
.add( 2017, 11, 6, 19, 19, 1, 0, ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 0, ZONE_PARIS )
.add( 2017, 11, 6, 19, 19, 1, 500, ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 500, ZONE_PARIS )
.add( 1970, 1, 1, 0, 0, 0, 0, ZONE_GMT ) .skippedForDialects(
.add( 1900, 1, 1, 0, 0, 0, 0, ZONE_GMT ) // MySQL/Mariadb cannot store values equal to epoch exactly, or less, in a timestamp.
.add( 1900, 1, 1, 0, 0, 0, 0, ZONE_OSLO ) Arrays.asList( MySQLDialect.class, MariaDBDialect.class ),
.add( 1900, 1, 1, 0, 0, 0, 0, ZONE_PARIS ) b -> b
.add( 1900, 1, 2, 0, 9, 21, 0, ZONE_PARIS ) .add( 1970, 1, 1, 0, 0, 0, 0, ZONE_GMT )
.add( 1900, 1, 1, 0, 0, 0, 0, ZONE_AMSTERDAM ) .add( 1900, 1, 1, 0, 0, 0, 0, ZONE_GMT )
.add( 1900, 1, 2, 0, 19, 32, 0, ZONE_AMSTERDAM ) .add( 1900, 1, 1, 0, 0, 0, 0, ZONE_OSLO )
// Affected by HHH-13266 (JDK-8061577) .add( 1900, 1, 1, 0, 0, 0, 0, ZONE_PARIS )
.add( 1892, 1, 1, 0, 0, 0, 0, ZONE_OSLO ) .add( 1900, 1, 2, 0, 9, 21, 0, ZONE_PARIS )
.add( 1899, 12, 31, 23, 59, 59, 999_999_999, ZONE_PARIS ) .add( 1900, 1, 1, 0, 0, 0, 0, ZONE_AMSTERDAM )
.add( 1899, 12, 31, 23, 59, 59, 999_999_999, ZONE_AMSTERDAM ) .add( 1900, 1, 2, 0, 19, 32, 0, ZONE_AMSTERDAM )
.add( 1600, 1, 1, 0, 0, 0, 0, ZONE_AMSTERDAM ) // Affected by HHH-13266 (JDK-8061577)
.add( 1892, 1, 1, 0, 0, 0, 0, ZONE_OSLO )
.add( 1899, 12, 31, 23, 59, 59, 999_999_999, ZONE_PARIS )
.add( 1899, 12, 31, 23, 59, 59, 999_999_999, ZONE_AMSTERDAM )
.add( 1600, 1, 1, 0, 0, 0, 0, ZONE_AMSTERDAM )
)
.build(); .build();
} }

View File

@ -14,12 +14,15 @@ import java.sql.Timestamp;
import java.sql.Types; import java.sql.Types;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor; import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
@ -44,16 +47,21 @@ public class LocalDateTest extends AbstractJavaTimeTypeTest<LocalDate, LocalDate
// Not affected by HHH-13266 (JDK-8061577) // Not affected by HHH-13266 (JDK-8061577)
.add( 2017, 11, 6, ZONE_UTC_MINUS_8 ) .add( 2017, 11, 6, ZONE_UTC_MINUS_8 )
.add( 2017, 11, 6, ZONE_PARIS ) .add( 2017, 11, 6, ZONE_PARIS )
.add( 1970, 1, 1, ZONE_GMT ) .skippedForDialects(
.add( 1900, 1, 1, ZONE_GMT ) // MySQL/Mariadb cannot store values equal to epoch exactly, or less, in a timestamp.
.add( 1900, 1, 1, ZONE_OSLO ) Arrays.asList( MySQLDialect.class, MariaDBDialect.class ),
.add( 1900, 1, 2, ZONE_PARIS ) b -> b
.add( 1900, 1, 2, ZONE_AMSTERDAM ) .add( 1970, 1, 1, ZONE_GMT )
// Affected by HHH-13266 (JDK-8061577), but only when remapping dates as timestamps .add( 1900, 1, 1, ZONE_GMT )
.add( 1892, 1, 1, ZONE_OSLO ) .add( 1900, 1, 1, ZONE_OSLO )
.add( 1900, 1, 1, ZONE_PARIS ) .add( 1900, 1, 2, ZONE_PARIS )
.add( 1900, 1, 1, ZONE_AMSTERDAM ) .add( 1900, 1, 2, ZONE_AMSTERDAM )
.add( 1600, 1, 1, ZONE_AMSTERDAM ) // Affected by HHH-13266 (JDK-8061577), but only when remapping dates as timestamps
.add( 1892, 1, 1, ZONE_OSLO )
.add( 1900, 1, 1, ZONE_PARIS )
.add( 1900, 1, 1, ZONE_AMSTERDAM )
.add( 1600, 1, 1, ZONE_AMSTERDAM )
)
.build(); .build();
} }

View File

@ -12,12 +12,16 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
/** /**
@ -42,16 +46,21 @@ public class LocalDateTimeTest extends AbstractJavaTimeTypeTest<LocalDateTime, L
.add( 2017, 11, 6, 19, 19, 1, 0, ZONE_UTC_MINUS_8 ) .add( 2017, 11, 6, 19, 19, 1, 0, ZONE_UTC_MINUS_8 )
.add( 2017, 11, 6, 19, 19, 1, 0, ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 0, ZONE_PARIS )
.add( 2017, 11, 6, 19, 19, 1, 500, ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 500, ZONE_PARIS )
.add( 1970, 1, 1, 0, 0, 0, 0, ZONE_GMT ) .skippedForDialects(
.add( 1900, 1, 1, 0, 0, 0, 0, ZONE_GMT ) // MySQL/Mariadb cannot store values equal to epoch exactly, or less, in a timestamp.
.add( 1900, 1, 1, 0, 0, 0, 0, ZONE_OSLO ) Arrays.asList( MySQLDialect.class, MariaDBDialect.class ),
.add( 1900, 1, 2, 0, 9, 21, 0, ZONE_PARIS ) b -> b
.add( 1900, 1, 2, 0, 19, 32, 0, ZONE_AMSTERDAM ) .add( 1970, 1, 1, 0, 0, 0, 0, ZONE_GMT )
// Affected by HHH-13266 (JDK-8061577) .add( 1900, 1, 1, 0, 0, 0, 0, ZONE_GMT )
.add( 1892, 1, 1, 0, 0, 0, 0, ZONE_OSLO ) .add( 1900, 1, 1, 0, 0, 0, 0, ZONE_OSLO )
.add( 1900, 1, 1, 0, 9, 20, 0, ZONE_PARIS ) .add( 1900, 1, 2, 0, 9, 21, 0, ZONE_PARIS )
.add( 1900, 1, 1, 0, 19, 31, 0, ZONE_AMSTERDAM ) .add( 1900, 1, 2, 0, 19, 32, 0, ZONE_AMSTERDAM )
.add( 1600, 1, 1, 0, 0, 0, 0, ZONE_AMSTERDAM ) // Affected by HHH-13266 (JDK-8061577)
.add( 1892, 1, 1, 0, 0, 0, 0, ZONE_OSLO )
.add( 1900, 1, 1, 0, 9, 20, 0, ZONE_PARIS )
.add( 1900, 1, 1, 0, 19, 31, 0, ZONE_AMSTERDAM )
.add( 1600, 1, 1, 0, 0, 0, 0, ZONE_AMSTERDAM )
)
.build(); .build();
} }

View File

@ -14,12 +14,15 @@ import java.sql.Timestamp;
import java.sql.Types; import java.sql.Types;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor; import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
@ -59,18 +62,23 @@ public class LocalTimeTest extends AbstractJavaTimeTypeTest<LocalTime, LocalTime
.add( 19, 19, 1, 0, ZONE_UTC_MINUS_8 ) .add( 19, 19, 1, 0, ZONE_UTC_MINUS_8 )
.add( 19, 19, 1, 0, ZONE_PARIS ) .add( 19, 19, 1, 0, ZONE_PARIS )
.add( 19, 19, 1, 500, ZONE_PARIS ) .add( 19, 19, 1, 500, ZONE_PARIS )
.add( 0, 0, 0, 0, ZONE_GMT )
.add( 0, 0, 0, 0, ZONE_OSLO )
.add( 0, 9, 20, 0, ZONE_PARIS ) .add( 0, 9, 20, 0, ZONE_PARIS )
.add( 0, 19, 31, 0, ZONE_AMSTERDAM ) .add( 0, 19, 31, 0, ZONE_AMSTERDAM )
.add( 0, 0, 0, 0, ZONE_AMSTERDAM ) .skippedForDialects(
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 0, 0, 0, ZONE_OSLO ) // MySQL/Mariadb cannot store values equal to epoch exactly, or less, in a timestamp.
.addPersistedWithoutHibernate( 1900, 1, 2, 0, 9, 21, 0, ZONE_PARIS ) Arrays.asList( MySQLDialect.class, MariaDBDialect.class ),
.addPersistedWithoutHibernate( 1900, 1, 2, 0, 19, 32, 0, ZONE_AMSTERDAM ) b -> b
.addPersistedWithoutHibernate( 1892, 1, 1, 0, 0, 0, 0, ZONE_OSLO ) .add( 0, 0, 0, 0, ZONE_GMT )
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 9, 20, 0, ZONE_PARIS ) .add( 0, 0, 0, 0, ZONE_OSLO )
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 19, 31, 0, ZONE_AMSTERDAM ) .add( 0, 0, 0, 0, ZONE_AMSTERDAM )
.addPersistedWithoutHibernate( 1600, 1, 1, 0, 0, 0, 0, ZONE_AMSTERDAM ) .addPersistedWithoutHibernate( 1900, 1, 1, 0, 0, 0, 0, ZONE_OSLO )
.addPersistedWithoutHibernate( 1900, 1, 2, 0, 9, 21, 0, ZONE_PARIS )
.addPersistedWithoutHibernate( 1900, 1, 2, 0, 19, 32, 0, ZONE_AMSTERDAM )
.addPersistedWithoutHibernate( 1892, 1, 1, 0, 0, 0, 0, ZONE_OSLO )
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 9, 20, 0, ZONE_PARIS )
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 19, 31, 0, ZONE_AMSTERDAM )
.addPersistedWithoutHibernate( 1600, 1, 1, 0, 0, 0, 0, ZONE_AMSTERDAM )
)
.build(); .build();
} }

View File

@ -14,6 +14,7 @@ import java.time.LocalDateTime;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import javax.persistence.Basic; import javax.persistence.Basic;
@ -22,6 +23,8 @@ import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.Query; import org.hibernate.Query;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.type.OffsetDateTimeType; import org.hibernate.type.OffsetDateTimeType;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
@ -68,22 +71,27 @@ public class OffsetDateTimeTest extends AbstractJavaTimeTypeTest<OffsetDateTime,
.add( 2017, 11, 6, 19, 19, 1, 0, "-02:00", ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 0, "-02:00", ZONE_PARIS )
.add( 2017, 11, 6, 19, 19, 1, 0, "-06:00", ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 0, "-06:00", ZONE_PARIS )
.add( 2017, 11, 6, 19, 19, 1, 0, "-08:00", ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 0, "-08:00", ZONE_PARIS )
.add( 1970, 1, 1, 0, 0, 0, 0, "+01:00", ZONE_GMT ) .skippedForDialects(
.add( 1970, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_GMT ) // MySQL/Mariadb cannot store values equal to epoch exactly, or less, in a timestamp.
.add( 1970, 1, 1, 0, 0, 0, 0, "-01:00", ZONE_GMT ) Arrays.asList( MySQLDialect.class, MariaDBDialect.class ),
.add( 1900, 1, 1, 0, 0, 0, 0, "+01:00", ZONE_GMT ) b -> b
.add( 1900, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_GMT ) .add( 1970, 1, 1, 0, 0, 0, 0, "+01:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 0, 0, 0, "-01:00", ZONE_GMT ) .add( 1970, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_OSLO ) .add( 1970, 1, 1, 0, 0, 0, 0, "-01:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 9, 21, 0, "+00:09:21", ZONE_PARIS ) .add( 1900, 1, 1, 0, 0, 0, 0, "+01:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 19, 32, 0, "+00:19:32", ZONE_PARIS ) .add( 1900, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 19, 32, 0, "+00:19:32", ZONE_AMSTERDAM ) .add( 1900, 1, 1, 0, 0, 0, 0, "-01:00", ZONE_GMT )
// Affected by HHH-13266 .add( 1900, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_OSLO )
.add( 1892, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_OSLO ) .add( 1900, 1, 1, 0, 9, 21, 0, "+00:09:21", ZONE_PARIS )
.add( 1900, 1, 1, 0, 9, 20, 0, "+00:09:21", ZONE_PARIS ) .add( 1900, 1, 1, 0, 19, 32, 0, "+00:19:32", ZONE_PARIS )
.add( 1900, 1, 1, 0, 19, 31, 0, "+00:19:32", ZONE_PARIS ) .add( 1900, 1, 1, 0, 19, 32, 0, "+00:19:32", ZONE_AMSTERDAM )
.add( 1900, 1, 1, 0, 19, 31, 0, "+00:19:32", ZONE_AMSTERDAM ) // Affected by HHH-13266
.add( 1600, 1, 1, 0, 0, 0, 0, "+00:19:32", ZONE_AMSTERDAM ) .add( 1892, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_OSLO )
.add( 1900, 1, 1, 0, 9, 20, 0, "+00:09:21", ZONE_PARIS )
.add( 1900, 1, 1, 0, 19, 31, 0, "+00:19:32", ZONE_PARIS )
.add( 1900, 1, 1, 0, 19, 31, 0, "+00:19:32", ZONE_AMSTERDAM )
.add( 1600, 1, 1, 0, 0, 0, 0, "+00:19:32", ZONE_AMSTERDAM )
)
.build(); .build();
} }

View File

@ -16,12 +16,15 @@ import java.time.OffsetDateTime;
import java.time.OffsetTime; import java.time.OffsetTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.type.descriptor.sql.BigIntTypeDescriptor; import org.hibernate.type.descriptor.sql.BigIntTypeDescriptor;
import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor; import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor;
@ -66,19 +69,24 @@ public class OffsetTimeTest extends AbstractJavaTimeTypeTest<OffsetTime, OffsetT
.add( 19, 19, 1, 0, "+01:30", ZONE_PARIS ) .add( 19, 19, 1, 0, "+01:30", ZONE_PARIS )
.add( 19, 19, 1, 500, "+01:00", ZONE_PARIS ) .add( 19, 19, 1, 500, "+01:00", ZONE_PARIS )
.add( 19, 19, 1, 0, "-08:00", ZONE_PARIS ) .add( 19, 19, 1, 0, "-08:00", ZONE_PARIS )
.add( 0, 0, 0, 0, "+01:00", ZONE_GMT )
.add( 0, 0, 0, 0, "+00:00", ZONE_GMT )
.add( 0, 0, 0, 0, "-01:00", ZONE_GMT )
.add( 0, 0, 0, 0, "+00:00", ZONE_OSLO )
.add( 0, 9, 20, 0, "+00:09:21", ZONE_PARIS ) .add( 0, 9, 20, 0, "+00:09:21", ZONE_PARIS )
.add( 0, 19, 31, 0, "+00:19:32", ZONE_PARIS ) .add( 0, 19, 31, 0, "+00:19:32", ZONE_PARIS )
.add( 0, 19, 31, 0, "+00:19:32", ZONE_AMSTERDAM ) .add( 0, 19, 31, 0, "+00:19:32", ZONE_AMSTERDAM )
.add( 0, 0, 0, 0, "+00:19:32", ZONE_AMSTERDAM ) .skippedForDialects(
.addPersistedWithoutHibernate( 1892, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_OSLO ) // MySQL/Mariadb cannot store values equal to epoch exactly, or less, in a timestamp.
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 9, 20, 0, "+00:09:21", ZONE_PARIS ) Arrays.asList( MySQLDialect.class, MariaDBDialect.class ),
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 19, 31, 0, "+00:19:32", ZONE_PARIS ) b -> b
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 19, 31, 0, "+00:19:32", ZONE_AMSTERDAM ) .add( 0, 0, 0, 0, "+01:00", ZONE_GMT )
.addPersistedWithoutHibernate( 1600, 1, 1, 0, 0, 0, 0, "+00:19:32", ZONE_AMSTERDAM ) .add( 0, 0, 0, 0, "+00:00", ZONE_GMT )
.add( 0, 0, 0, 0, "-01:00", ZONE_GMT )
.add( 0, 0, 0, 0, "+00:00", ZONE_OSLO )
.add( 0, 0, 0, 0, "+00:19:32", ZONE_AMSTERDAM )
.addPersistedWithoutHibernate( 1892, 1, 1, 0, 0, 0, 0, "+00:00", ZONE_OSLO )
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 9, 20, 0, "+00:09:21", ZONE_PARIS )
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 19, 31, 0, "+00:19:32", ZONE_PARIS )
.addPersistedWithoutHibernate( 1900, 1, 1, 0, 19, 31, 0, "+00:19:32", ZONE_AMSTERDAM )
.addPersistedWithoutHibernate( 1600, 1, 1, 0, 0, 0, 0, "+00:19:32", ZONE_AMSTERDAM )
)
.build(); .build();
} }

View File

@ -14,6 +14,7 @@ import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import javax.persistence.Basic; import javax.persistence.Basic;
@ -22,6 +23,8 @@ import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.Query; import org.hibernate.Query;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.type.ZonedDateTimeType; import org.hibernate.type.ZonedDateTimeType;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
@ -72,30 +75,35 @@ public class ZonedDateTimeTest extends AbstractJavaTimeTypeTest<ZonedDateTime, Z
.add( 2017, 11, 6, 19, 19, 1, 0, "GMT-02:00", ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 0, "GMT-02:00", ZONE_PARIS )
.add( 2017, 11, 6, 19, 19, 1, 0, "GMT-06:00", ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 0, "GMT-06:00", ZONE_PARIS )
.add( 2017, 11, 6, 19, 19, 1, 0, "GMT-08:00", ZONE_PARIS ) .add( 2017, 11, 6, 19, 19, 1, 0, "GMT-08:00", ZONE_PARIS )
.add( 1970, 1, 1, 0, 0, 0, 0, "GMT+01:00", ZONE_GMT ) .skippedForDialects(
.add( 1970, 1, 1, 0, 0, 0, 0, "GMT+00:00", ZONE_GMT ) // MySQL/Mariadb cannot store values equal to epoch exactly, or less, in a timestamp.
.add( 1970, 1, 1, 0, 0, 0, 0, "GMT-01:00", ZONE_GMT ) Arrays.asList( MySQLDialect.class, MariaDBDialect.class ),
.add( 1900, 1, 1, 0, 0, 0, 0, "GMT+01:00", ZONE_GMT ) b -> b
.add( 1900, 1, 1, 0, 0, 0, 0, "GMT+00:00", ZONE_GMT ) .add( 1970, 1, 1, 0, 0, 0, 0, "GMT+01:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 0, 0, 0, "GMT-01:00", ZONE_GMT ) .add( 1970, 1, 1, 0, 0, 0, 0, "GMT+00:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 0, 0, 0, "GMT+00:00", ZONE_OSLO ) .add( 1970, 1, 1, 0, 0, 0, 0, "GMT-01:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 9, 21, 0, "GMT+00:09:21", ZONE_PARIS ) .add( 1900, 1, 1, 0, 0, 0, 0, "GMT+01:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 9, 21, 0, "Europe/Paris", ZONE_PARIS ) .add( 1900, 1, 1, 0, 0, 0, 0, "GMT+00:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 19, 31, 0, "Europe/Paris", ZONE_PARIS ) .add( 1900, 1, 1, 0, 0, 0, 0, "GMT-01:00", ZONE_GMT )
.add( 1900, 1, 1, 0, 19, 32, 0, "GMT+00:19:32", ZONE_PARIS ) .add( 1900, 1, 1, 0, 0, 0, 0, "GMT+00:00", ZONE_OSLO )
.add( 1900, 1, 1, 0, 19, 32, 0, "Europe/Amsterdam", ZONE_PARIS ) .add( 1900, 1, 1, 0, 9, 21, 0, "GMT+00:09:21", ZONE_PARIS )
.add( 1900, 1, 1, 0, 19, 32, 0, "GMT+00:19:32", ZONE_AMSTERDAM ) .add( 1900, 1, 1, 0, 9, 21, 0, "Europe/Paris", ZONE_PARIS )
.add( 1900, 1, 1, 0, 19, 32, 0, "Europe/Amsterdam", ZONE_AMSTERDAM ) .add( 1900, 1, 1, 0, 19, 31, 0, "Europe/Paris", ZONE_PARIS )
// Affected by HHH-13266 .add( 1900, 1, 1, 0, 19, 32, 0, "GMT+00:19:32", ZONE_PARIS )
.add( 1892, 1, 1, 0, 0, 0, 0, "GMT+00:00", ZONE_OSLO ) .add( 1900, 1, 1, 0, 19, 32, 0, "Europe/Amsterdam", ZONE_PARIS )
.add( 1892, 1, 1, 0, 0, 0, 0, "Europe/Oslo", ZONE_OSLO ) .add( 1900, 1, 1, 0, 19, 32, 0, "GMT+00:19:32", ZONE_AMSTERDAM )
.add( 1900, 1, 1, 0, 9, 20, 0, "GMT+00:09:21", ZONE_PARIS ) .add( 1900, 1, 1, 0, 19, 32, 0, "Europe/Amsterdam", ZONE_AMSTERDAM )
.add( 1900, 1, 1, 0, 9, 20, 0, "Europe/Paris", ZONE_PARIS ) // Affected by HHH-13266
.add( 1900, 1, 1, 0, 19, 31, 0, "GMT+00:19:32", ZONE_PARIS ) .add( 1892, 1, 1, 0, 0, 0, 0, "GMT+00:00", ZONE_OSLO )
.add( 1900, 1, 1, 0, 19, 31, 0, "GMT+00:19:32", ZONE_AMSTERDAM ) .add( 1892, 1, 1, 0, 0, 0, 0, "Europe/Oslo", ZONE_OSLO )
.add( 1900, 1, 1, 0, 19, 31, 0, "Europe/Amsterdam", ZONE_AMSTERDAM ) .add( 1900, 1, 1, 0, 9, 20, 0, "GMT+00:09:21", ZONE_PARIS )
.add( 1600, 1, 1, 0, 0, 0, 0, "GMT+00:19:32", ZONE_AMSTERDAM ) .add( 1900, 1, 1, 0, 9, 20, 0, "Europe/Paris", ZONE_PARIS )
.add( 1600, 1, 1, 0, 0, 0, 0, "Europe/Amsterdam", ZONE_AMSTERDAM ) .add( 1900, 1, 1, 0, 19, 31, 0, "GMT+00:19:32", ZONE_PARIS )
.add( 1900, 1, 1, 0, 19, 31, 0, "GMT+00:19:32", ZONE_AMSTERDAM )
.add( 1900, 1, 1, 0, 19, 31, 0, "Europe/Amsterdam", ZONE_AMSTERDAM )
.add( 1600, 1, 1, 0, 0, 0, 0, "GMT+00:19:32", ZONE_AMSTERDAM )
.add( 1600, 1, 1, 0, 0, 0, 0, "Europe/Amsterdam", ZONE_AMSTERDAM )
)
.build(); .build();
} }