HHH-10312 : Unit test failures due to DB problems interpreting proper type for null value when bound to a query

(cherry picked from commit 519ba7175f)
This commit is contained in:
Gail Badner 2015-11-20 18:55:20 -08:00
parent d5fb3761c6
commit d5017c339c
2 changed files with 36 additions and 16 deletions

View File

@ -22,14 +22,19 @@ import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.MySQL57InnoDBDialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQL92Dialect;
import org.hibernate.dialect.PostgreSQL9Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.stat.Statistics;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.SkipForDialects;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.test.annotations.A320;
@ -98,10 +103,13 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
@Test
@TestForIssue( jiraKey = "HHH-10161")
@SkipForDialect(
value = Oracle8iDialect.class,
jiraKey = "HHH-10161",
comment = "Oracle cannot convert untyped null (assumed to be BINARY type) to NUMBER")
@SkipForDialects(
value = {
@SkipForDialect(value = Oracle8iDialect.class, jiraKey = "HHH-10161", comment = "Cannot convert untyped null (assumed to be BINARY type) to NUMBER"),
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
}
)
public void testQueryWithNullParameter(){
Chaos c0 = new Chaos();
c0.setId( 0L );
@ -182,10 +190,13 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
@Test
@TestForIssue( jiraKey = "HHH-10161")
@SkipForDialect(
value = Oracle8iDialect.class,
jiraKey = "HHH-10161",
comment = "Oracle cannot convert untyped null (assumed to be BINARY type) to NUMBER")
@SkipForDialects(
value = {
@SkipForDialect(value = Oracle8iDialect.class, jiraKey = "HHH-10161", comment = "Cannot convert untyped null (assumed to be BINARY type) to NUMBER"),
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
}
)
public void testNativeQueryWithNullParameter(){
Chaos c0 = new Chaos();
c0.setId( 0L );

View File

@ -19,6 +19,8 @@ import org.junit.Test;
import org.hibernate.Hibernate;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.PostgreSQL9Dialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.jpa.test.Distributor;
@ -29,6 +31,7 @@ import org.hibernate.stat.Statistics;
import junit.framework.Assert;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.SkipForDialects;
import org.hibernate.testing.TestForIssue;
import static junit.framework.Assert.assertNull;
@ -298,10 +301,13 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(
value = Oracle8iDialect.class,
jiraKey = "HHH-10161",
comment = "Oracle cannot convert untyped null (assumed to be BINARY type) to NUMBER")
@SkipForDialects(
value = {
@SkipForDialect(value = Oracle8iDialect.class, jiraKey = "HHH-10161", comment = "Cannot convert untyped null (assumed to be BINARY type) to NUMBER"),
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
}
)
public void testNativeQueryNullPositionalParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
@ -368,10 +374,13 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(
value = Oracle8iDialect.class,
jiraKey = "HHH-10161",
comment = "Oracle cannot convert untyped null (assumed to be BINARY type) to NUMBER")
@SkipForDialects(
value = {
@SkipForDialect(value = Oracle8iDialect.class, jiraKey = "HHH-10161", comment = "Cannot convert untyped null (assumed to be BINARY type) to NUMBER"),
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint"),
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
}
)
public void testNativeQueryNullNamedParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();