ClassCastException when rendering SimpleCaseExpression
Description
When creating a SimpleCase using CriteriaBuilder.selectCase(Expression<?> arg0), a classcast exception will be thrown when the query is rendered to a TypedQuery.
See attachement for a reproduction project.
Environment
SQL Server 2005
Activity
Show:
Steve Ebersole
April 2, 2014, 7:46 PM
Pushed to master (5.0) and 4.3 branches
Viliam ġurina
January 2, 2013, 3:11 PM
I thought about this workaround:
Case<String, Integer> orderCase = builder.selectCase()
.when(builder.equal(root.get(Customer_.EMail), "test@test.com"), 1)
.when(builder.equal(root.get(Customer_.EMail), "test2@test.com"), 2)
.otherwise(0);
query.orderBy(builder.asc(orderCase));
em.createQuery(query);
But it does not work because of the bug https://hibernate.onjira.com/browse/HHH-4700
Please fix these annoying simple bugs.
Fixed
Assignee
Reporter
Fix versions
Labels
backPortable
None
Suitable for new contributors
None
Requires Release Note
None
Pull Request
None
backportDecision
None