HQL putting quotes around SMALLINT field

Description

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.

Environment

Hibernate 3.3.1 using org.hibernate.dialect.DB2Dialect against DB2 v9.1

Activity

Show:
Gail Badner
April 27, 2010, 9:21 AM

Please attach a runnable test case (Java + mapping) that reproduces your issue.

Shawn Kuenzler
April 30, 2010, 10:31 AM

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.

Rejected

Assignee

Unassigned

Reporter

Shawn Kuenzler

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major