I'm using Hibernate 5.2.9.
I can't seem to create a selectCase() with mutliple when() conditions without also calling otherwise(). Without otherwise() I always get the following error.
Code:
java.lang.NullPointerException
at org.hibernate.query.criteria.internal.expression.SearchedCaseExpression.lambda$render$0(SearchedCaseExpression.java:120)
at org.hibernate.query.criteria.internal.expression.SearchedCaseExpression.render(SearchedCaseExpression.java:142)
at org.hibernate.query.criteria.internal.expression.SearchedCaseExpression.render(SearchedCaseExpression.java:118)
at org.hibernate.query.criteria.internal.CriteriaUpdateImpl.renderAssignments(CriteriaUpdateImpl.java:133)
at org.hibernate.query.criteria.internal.CriteriaUpdateImpl.renderQuery(CriteriaUpdateImpl.java:118)
at org.hibernate.query.criteria.internal.AbstractManipulationCriteriaQuery.interpret(AbstractManipulationCriteriaQuery.java:102)
at org.hibernate.query.criteria.internal.compile.CriteriaCompiler.compile(CriteriaCompiler.java:127)
at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:3611)
at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:203)
at.... (my method call)
There's a test case below that can be used, just remove the orderBy clause in Main.java
https://hibernate.atlassian.net/browse/HHH-6747I looked around for related bugs but didn't find anything. I'm also not sure what the ANSI sql spec is on this.