We're updating the issue view to help you get more done. 

Skip "case when" tests requiring casts for DB2

Description

Following tests fails with DB2 because hibernate generates wrong query. It's missing casting of parameters in case expression part of query

org.hibernate.jpa.test.criteria.selectcase.SelectCaseTest.selectCaseWithCastedTypeValuesShouldWork
org.hibernate.jpa.test.criteria.selectcase.SelectCaseTest.selectCaseWithValuesShouldWork
org.hibernate.jpa.test.criteria.selectcase.SelectCaseTest.simpleSelectCaseWithCastedTypeValuesShouldWork
org.hibernate.jpa.test.criteria.selectcase.SelectCaseTest.simpleSelectCaseWithValuesShouldWork
org.hibernate.jpa.test.criteria.selectcase.GroupBySelectCaseTest.selectCaseInOrderByAndSelectExpression
org.hibernate.query.criteria.internal.expression.SearchedCaseExpressionTest.testEqualClause

Example from: SelectCaseTest.selectCaseWithValuesShouldWork
generated query is:

1 2 3 4 5 6 7 8 9 10 11 15:14:28,210 DEBUG SQL:94 - select selectcase0_.id as id1_0_, selectcase0_.value as value2_0_ from entity selectcase0_ where cast(selectcase0_.value as varchar(255))=case when 1=1 then ? else ? end

but it probably should be

1 2 3 4 5 6 7 8 9 10 11 15:14:28,210 DEBUG SQL:94 - select selectcase0_.id as id1_0_, selectcase0_.value as value2_0_ from entity selectcase0_ where cast(selectcase0_.value as varchar(255))=case when 1=1 then cast(? as varchar(255)) else cast(? as varchar(255)) end

Attached full output from SelectCaseTest.selectCaseWithValuesShouldWork

Environment

DB2

Status

Assignee

Guillaume Smet

Reporter

Martin Šimka

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

Components

Affects versions

5.3.2

Priority

Major