-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: CriteriaBuilder.Case or SimpleCase: is otherwise() required?
PostPosted: Mon Dec 18, 2017 4:36 pm 
Newbie

Joined: Wed Feb 22, 2017 4:35 pm
Posts: 19
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-6747

I looked around for related bugs but didn't find anything. I'm also not sure what the ANSI sql spec is on this.


Top
 Profile  
 
 Post subject: Re: CriteriaBuilder.Case or SimpleCase: is otherwise() required?
PostPosted: Wed Dec 20, 2017 5:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1630
Location: Romania
Please create a new Jira issue and attach the replicating test case you used after modifying the HHH-6747 test case.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.