diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/InformixDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/InformixDialect.java index 00b64ef770..77a2543a6c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/InformixDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/InformixDialect.java @@ -6,6 +6,10 @@ */ package org.hibernate.dialect; +import java.sql.SQLException; +import java.sql.Types; +import java.util.Locale; + import org.hibernate.dialect.function.VarArgsSQLFunction; import org.hibernate.dialect.identity.IdentityColumnSupport; import org.hibernate.dialect.identity.InformixIdentityColumnSupport; @@ -23,10 +27,6 @@ import org.hibernate.internal.util.JdbcExceptionHelper; import org.hibernate.internal.util.StringHelper; import org.hibernate.type.StandardBasicTypes; -import java.sql.SQLException; -import java.sql.Types; -import java.util.Locale; - /** * Informix dialect.
*
@@ -277,4 +277,9 @@ public class InformixDialect extends Dialect { public IdentityColumnSupport getIdentityColumnSupport() { return new InformixIdentityColumnSupport(); } + + @Override + public String toBooleanValueString(boolean bool) { + return bool ? "'t'" : "'f'"; + } } diff --git a/hibernate-core/src/test/java/org/hibernate/dialect/InformixDialectTestCase.java b/hibernate-core/src/test/java/org/hibernate/dialect/InformixDialectTestCase.java new file mode 100644 index 0000000000..1d03deb38d --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/dialect/InformixDialectTestCase.java @@ -0,0 +1,34 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.dialect; + +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.junit4.BaseUnitTestCase; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Testing of patched support for Informix boolean type; see HHH-9894 + * + * @author Greg Jones + */ +@TestForIssue( jiraKey = "HHH-9894" ) +public class InformixDialectTestCase extends BaseUnitTestCase { + private final InformixDialect dialect = new InformixDialect(); + + @Test + public void testToBooleanValueStringTrue() { + assertEquals( "'t'", dialect.toBooleanValueString( true ) ); + } + + @Test + public void testToBooleanValueStringFalse() { + assertEquals( "'f'", dialect.toBooleanValueString( false ) ); + } + +}