HQL query generating a WHERE clause with a mapped column of java type "int" and datatype "SMALLINT" in DB2. The generated prepared statement inside of AbstractBatcher.class shows single quotes around the value (i.e. '11'). DB2 complains with a "SQL0401N The data types of the operands for the operation "=" are not compatible." error. Running the query in the DB2 Command Center I see it just needs the quotes removed.
I see that in SQLServer 2008, where the same legacy database field has a datatype of "TINYINT", SQLServer is accepting of the single quoted value in the HQL statement.
Hibernate 3.3.1 using org.hibernate.dialect.DB2Dialect against DB2 v9.1
Please attach a runnable test case (Java + mapping) that reproduces your issue.
In developing a test case, I found that it was only the discriminator columns that were being quoted. Added "discriminatorType = DiscriminatorType.INTEGER" to the discriminator column annotation and the problem was fixed. Not a bug.