Example from: SelectCaseTest.selectCaseWithValuesShouldWork generated query is:
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
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
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:
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
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