diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java index 694fa05dae..02b4255d56 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java @@ -457,8 +457,10 @@ public class DB2Dialect extends Dialect { functionFactory.generateSeries_recursive( getMaximumSeriesSize(), false, true ); functionFactory.hex( "hex(?1)" ); - functionFactory.sha( "hash(?1, 2)" ); - functionFactory.md5( "hash(?1, 0)" ); + if ( getDB2Version().isSameOrAfter( 11 ) ) { + functionFactory.sha( "hash(?1, 2)" ); + functionFactory.md5( "hash(?1, 0)" ); + } } /** diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java index 38bbebe181..e48d9e120d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java @@ -2612,7 +2612,7 @@ public class FunctionTests { @RequiresDialect(PostgreSQLDialect.class) @RequiresDialect(MySQLDialect.class) @RequiresDialect(OracleDialect.class) - @RequiresDialect(DB2Dialect.class) + @RequiresDialect(value = DB2Dialect.class, majorVersion = 11) @RequiresDialect(SQLServerDialect.class) @RequiresDialect(H2Dialect.class) @RequiresDialect(HANADialect.class)