• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using 'Case when' in Hibernate Criteria API

 
John Bartlett
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to create a dynamic query using criteria, but i cannot find any way of using the Case When condition?

Can you use the sql 'Case When' condition using criteria?

Thank you,

John
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think so. CASE WHEN is Oracle specific, you can have if statements around building your Criteria object, if that works for you, but if you want to use a DBMS specific SQL command, then I suggest using the SQLQuery object instead of the Criteria object.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic