Skip to content

Commit 519ba71

Browse files
committed
HHH-10312 : Unit test failures due to DB problems interpreting proper type for null value when bound to a query
1 parent 439dab8 commit 519ba71

File tree

2 files changed

+36
-16
lines changed

2 files changed

+36
-16
lines changed

hibernate-core/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,19 @@
2222
import org.hibernate.Transaction;
2323
import org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl;
2424
import org.hibernate.cfg.Configuration;
25+
import org.hibernate.dialect.MySQL57InnoDBDialect;
2526
import org.hibernate.dialect.Oracle8iDialect;
2627
import org.hibernate.dialect.PostgreSQL81Dialect;
28+
import org.hibernate.dialect.PostgreSQL92Dialect;
29+
import org.hibernate.dialect.PostgreSQL9Dialect;
2730
import org.hibernate.dialect.PostgreSQLDialect;
31+
import org.hibernate.dialect.PostgresPlusDialect;
2832
import org.hibernate.dialect.function.SQLFunction;
2933
import org.hibernate.stat.Statistics;
3034

3135
import org.hibernate.testing.FailureExpected;
3236
import org.hibernate.testing.SkipForDialect;
37+
import org.hibernate.testing.SkipForDialects;
3338
import org.hibernate.testing.TestForIssue;
3439
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
3540
import org.hibernate.test.annotations.A320;
@@ -98,10 +103,13 @@ public void testNativeQueryWithFormulaAttributeWithoutAlias() {
98103

99104
@Test
100105
@TestForIssue( jiraKey = "HHH-10161")
101-
@SkipForDialect(
102-
value = Oracle8iDialect.class,
103-
jiraKey = "HHH-10161",
104-
comment = "Oracle cannot convert untyped null (assumed to be BINARY type) to NUMBER")
106+
@SkipForDialects(
107+
value = {
108+
@SkipForDialect(value = Oracle8iDialect.class, jiraKey = "HHH-10161", comment = "Cannot convert untyped null (assumed to be BINARY type) to NUMBER"),
109+
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
110+
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
111+
}
112+
)
105113
public void testQueryWithNullParameter(){
106114
Chaos c0 = new Chaos();
107115
c0.setId( 0L );
@@ -182,10 +190,13 @@ public void testQueryWithNullParameterTyped(){
182190

183191
@Test
184192
@TestForIssue( jiraKey = "HHH-10161")
185-
@SkipForDialect(
186-
value = Oracle8iDialect.class,
187-
jiraKey = "HHH-10161",
188-
comment = "Oracle cannot convert untyped null (assumed to be BINARY type) to NUMBER")
193+
@SkipForDialects(
194+
value = {
195+
@SkipForDialect(value = Oracle8iDialect.class, jiraKey = "HHH-10161", comment = "Cannot convert untyped null (assumed to be BINARY type) to NUMBER"),
196+
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
197+
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
198+
}
199+
)
189200
public void testNativeQueryWithNullParameter(){
190201
Chaos c0 = new Chaos();
191202
c0.setId( 0L );

hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/query/QueryTest.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import org.hibernate.Hibernate;
2020
import org.hibernate.cfg.AvailableSettings;
2121
import org.hibernate.dialect.Oracle8iDialect;
22+
import org.hibernate.dialect.PostgreSQL9Dialect;
23+
import org.hibernate.dialect.PostgresPlusDialect;
2224
import org.hibernate.engine.spi.SessionFactoryImplementor;
2325
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
2426
import org.hibernate.jpa.test.Distributor;
@@ -29,6 +31,7 @@
2931
import junit.framework.Assert;
3032

3133
import org.hibernate.testing.SkipForDialect;
34+
import org.hibernate.testing.SkipForDialects;
3235
import org.hibernate.testing.TestForIssue;
3336

3437
import static junit.framework.Assert.assertNull;
@@ -298,10 +301,13 @@ public Class getParameterType() {
298301
}
299302

300303
@Test
301-
@SkipForDialect(
302-
value = Oracle8iDialect.class,
303-
jiraKey = "HHH-10161",
304-
comment = "Oracle cannot convert untyped null (assumed to be BINARY type) to NUMBER")
304+
@SkipForDialects(
305+
value = {
306+
@SkipForDialect(value = Oracle8iDialect.class, jiraKey = "HHH-10161", comment = "Cannot convert untyped null (assumed to be BINARY type) to NUMBER"),
307+
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
308+
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
309+
}
310+
)
305311
public void testNativeQueryNullPositionalParameter() throws Exception {
306312
EntityManager em = getOrCreateEntityManager();
307313
em.getTransaction().begin();
@@ -368,10 +374,13 @@ public Class getParameterType() {
368374
}
369375

370376
@Test
371-
@SkipForDialect(
372-
value = Oracle8iDialect.class,
373-
jiraKey = "HHH-10161",
374-
comment = "Oracle cannot convert untyped null (assumed to be BINARY type) to NUMBER")
377+
@SkipForDialects(
378+
value = {
379+
@SkipForDialect(value = Oracle8iDialect.class, jiraKey = "HHH-10161", comment = "Cannot convert untyped null (assumed to be BINARY type) to NUMBER"),
380+
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
381+
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
382+
}
383+
)
375384
public void testNativeQueryNullNamedParameter() throws Exception {
376385
EntityManager em = getOrCreateEntityManager();
377386
em.getTransaction().begin();

0 commit comments

Comments
 (0)