If you're getting erros use the "DB2 AS400" Dialect instead of the plain "DB2" Dialect. Initially the SQL generated by Hibernate gave me syntax errors from the DB2 JDBC Driver. Once I switched the Dialect to DB2 AS400 Hibernate generated completely different SQL that executed without error.