HHH-9250 : BigIntegerSequenceGeneratorTest.testBasics fails on MS SQL Server 2012

(cherry picked from commit 49fed0938e)
This commit is contained in:
Gail Badner 2015-04-20 17:45:15 -07:00
parent 51ddde4298
commit 59cbee44e7
3 changed files with 101 additions and 1 deletions

View File

@ -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();
}
}
}

View File

@ -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();
}
}

View File

@ -0,0 +1,44 @@
<?xml version="1.0"?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2010, 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
-->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!--
Demonstrates use of a sequence generator on a BigInteger property.
-->
<hibernate-mapping package="org.hibernate.test.idgen.biginteger.sequence">
<class name="Entity">
<id name="id" type="big_integer">
<column name="ID" scale="0"/>
<generator class="sequence">
</generator>
</id>
<property name="name" type="string"/>
</class>
</hibernate-mapping>