diff --git a/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/BigIntegerSequenceGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/BigIntegerSequenceGeneratorTest.java index 7d2d99342e..35991c58fb 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/BigIntegerSequenceGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/BigIntegerSequenceGeneratorTest.java @@ -26,8 +26,10 @@ package org.hibernate.test.idgen.biginteger.sequence; import org.junit.Test; import org.hibernate.Session; +import org.hibernate.dialect.SQLServer2012Dialect; import org.hibernate.testing.DialectChecks; import org.hibernate.testing.RequiresDialectFeature; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; /** @@ -40,6 +42,7 @@ public class BigIntegerSequenceGeneratorTest extends BaseCoreFunctionalTestCase } @Test + @SkipForDialect( SQLServer2012Dialect.class ) public void testBasics() { Session s = openSession(); s.beginTransaction(); @@ -63,4 +66,4 @@ public class BigIntegerSequenceGeneratorTest extends BaseCoreFunctionalTestCase s.close(); } -} \ No newline at end of file +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/BigIntegerSequenceGeneratorZeroScaleTest.java b/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/BigIntegerSequenceGeneratorZeroScaleTest.java new file mode 100644 index 0000000000..9d077f2952 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/BigIntegerSequenceGeneratorZeroScaleTest.java @@ -0,0 +1,53 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2015, Red Hat Inc. or third-party contributors as + * indicated by the @author tags or express copyright attribution + * statements applied by the authors. All third-party contributions are + * distributed under license by Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, modify, + * copy, or redistribute it subject to the terms and conditions of the GNU + * Lesser General Public License, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this distribution; if not, write to: + * Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301 USA + */ + +package org.hibernate.test.idgen.biginteger.sequence; + +import org.junit.Test; + +import org.hibernate.testing.DialectChecks; +import org.hibernate.testing.RequiresDialectFeature; +import org.hibernate.testing.TestForIssue; + +/** + * This test explicitly maps scale="0" for the sequence column. It works around the arithmetic + * overflow that happens because the generated column cannot accommodate the SQL Server + * sequence that starts, by default, with the value, -9,223,372,036,854,775,808. + * + * @author Gail Badner + */ +@RequiresDialectFeature( value = DialectChecks.SupportsSequences.class ) +public class BigIntegerSequenceGeneratorZeroScaleTest extends BigIntegerSequenceGeneratorTest { + + public String[] getMappings() { + return new String[] { "idgen/biginteger/sequence/ZeroScaleMapping.hbm.xml" }; + } + + @Test + @TestForIssue( jiraKey = "HHH-9250") + public void testBasics() { + super.testBasics(); + } + +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/ZeroScaleMapping.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/ZeroScaleMapping.hbm.xml new file mode 100644 index 0000000000..6f702394dc --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/idgen/biginteger/sequence/ZeroScaleMapping.hbm.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + +