Skip to content

Commit feca553

Browse files
committed
Informix rejects Integer.MAX_VALUE, Integer.MIN_VALUE
1 parent b9aa32c commit feca553

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/onetoone/EntityWithOneToOneJoinTableTest.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@
3838
@SessionFactory(generateStatistics = true)
3939
public class EntityWithOneToOneJoinTableTest {
4040

41+
final int maxInt = Integer.MAX_VALUE - 1;
42+
final int minInt = Integer.MIN_VALUE + 1;
43+
4144
@BeforeEach
4245
public void setUp(SessionFactoryScope scope) {
43-
EntityWithOneToOneJoinTable entity = new EntityWithOneToOneJoinTable( 1, "first", Integer.MAX_VALUE );
46+
EntityWithOneToOneJoinTable entity = new EntityWithOneToOneJoinTable( 1, "first", maxInt );
4447

4548
SimpleEntity other = new SimpleEntity(
4649
2,
4750
Calendar.getInstance().getTime(),
4851
null,
49-
Integer.MAX_VALUE,
52+
maxInt,
5053
Long.MAX_VALUE,
5154
null
5255
);
@@ -65,7 +68,7 @@ public void setUp(SessionFactoryScope scope) {
6568
EntityWithOneToOneJoinTable entity2 = new EntityWithOneToOneJoinTable(
6669
2,
6770
"second",
68-
Integer.MAX_VALUE
71+
maxInt
6972
);
7073

7174
SimpleEntity other2 = new SimpleEntity(
@@ -115,7 +118,7 @@ public void testGet(SessionFactoryScope scope) {
115118
session -> {
116119
final SimpleEntity loaded = session.get( SimpleEntity.class, 2 );
117120
assert loaded != null;
118-
assertThat( loaded.getSomeInteger(), equalTo( Integer.MAX_VALUE ) );
121+
assertThat( loaded.getSomeInteger(), equalTo( maxInt ) );
119122
}
120123
);
121124
}
@@ -225,7 +228,7 @@ public void testHqlSelectParentWithJoinFetch(SessionFactoryScope scope) {
225228

226229
@Test
227230
public void testUpdate(SessionFactoryScope scope) {
228-
EntityWithOneToOneJoinTable entity = new EntityWithOneToOneJoinTable( 3, "first", Integer.MAX_VALUE );
231+
EntityWithOneToOneJoinTable entity = new EntityWithOneToOneJoinTable( 3, "first", maxInt );
229232

230233
SimpleEntity other = new SimpleEntity(
231234
4,
@@ -249,7 +252,7 @@ public void testUpdate(SessionFactoryScope scope) {
249252
5,
250253
Calendar.getInstance().getTime(),
251254
null,
252-
Integer.MIN_VALUE,
255+
minInt,
253256
Long.MAX_VALUE,
254257
null
255258
);

hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/onetoone/EntityWithOneToOneTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,18 @@
4040
@SessionFactory(generateStatistics = true)
4141
public class EntityWithOneToOneTest {
4242

43+
final int maxInt = Integer.MAX_VALUE - 1;
44+
final int minInt = Integer.MIN_VALUE + 1;
45+
4346
@BeforeEach
4447
public void setUp(SessionFactoryScope scope) {
45-
EntityWithOneToOne entity = new EntityWithOneToOne( 1, "first", Integer.MAX_VALUE );
48+
EntityWithOneToOne entity = new EntityWithOneToOne( 1, "first", maxInt );
4649

4750
SimpleEntity other = new SimpleEntity(
4851
2,
4952
Calendar.getInstance().getTime(),
5053
null,
51-
Integer.MAX_VALUE,
54+
maxInt,
5255
Long.MAX_VALUE,
5356
null
5457
);
@@ -91,7 +94,7 @@ public void testGet(SessionFactoryScope scope) {
9194
session -> {
9295
final SimpleEntity loaded = session.get( SimpleEntity.class, 2 );
9396
assert loaded != null;
94-
assertThat( loaded.getSomeInteger(), equalTo( Integer.MAX_VALUE ) );
97+
assertThat( loaded.getSomeInteger(), equalTo( maxInt ) );
9598
}
9699
);
97100
}
@@ -102,7 +105,7 @@ public void testUpdate(SessionFactoryScope scope) {
102105
3,
103106
Calendar.getInstance().getTime(),
104107
null,
105-
Integer.MIN_VALUE,
108+
minInt,
106109
Long.MIN_VALUE,
107110
null
108111
);

0 commit comments

Comments
 (0)