]
Leonardo commented on HHH-5137:
-------------------------------
Hi Gail, what do you understand by "Improvement"? I thought the act of improving
something is to make a change for the better (but this something has already worked fine).
In this case, DB2Dialect doesn't work with a particular configuration of DB2.
That's a bug, not very important, but a bug!
NULLIF misinterpreted when a comma is set as a decimal point (DB2
z/OS)
-----------------------------------------------------------------------
Key: HHH-5137
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5137
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.3.2
Environment: Hibernate 3.3.2.GA, DB2 9 for z/OS
Reporter: Leonardo
Priority: Minor
Attachments: NullIfForDB2_zOS.zip
If we set in DB2 a comma (instead a period) as a separator for decimal point I get an
error when Hibernate executes this query:
DEBUG SQL:111 - select foo0_.id as id0_0_, foo0_.myBar_id as myBar1_3_0_, foo0_.clazz_ as
clazz_0_ from ( select nullif(0,0) as myBar_id, id, 0 as clazz_ from Foo union all select
nullif(0,0) as myBar_id, id, 1 as clazz_ from SubFoo2 union all select myBar_id, id, 2 as
clazz_ from SubFoo1 ) foo0_ where foo0_.id=?
com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -170,
SQLSTATE: 42605, SQLERRMC: NULLIF
In fact, DB2 interprets the argument of nullif(0,0) as a decimal number and not as two
arguments (zero, zero). DB2 documentation [1] says that if the comma is set as a decimal
point a comma intended as a separator must be followed by a space. so in that case,
nullif(0, 0) (note space after ',').
We are using DB2390Dialect and getSelectClauseNullString(int sqlType) method doesn't
generate a correct nullif instruction in this case.
we could circumvent this issue by extending DB2390Dialect class and placing spaces after
comma like this: return "nullif(" + literal + ", " + literal +
')'. But isn't a proper solution for us because we must release an extra jar
with custom dialect to our customers.
[1]
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/c...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: