Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4614694
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:44:09+00:00 2026-05-22T01:44:09+00:00

What would the equivalent of Oracle’s DECODE() function be in the Hibernate Criteria API?

  • 0

What would the equivalent of Oracle’s DECODE() function be in the Hibernate Criteria API?

An SQL example of what I need to do:

SELECT DECODE(FIRST_NAME, NULL, LAST_NAME, FIRST_NAME) as NAME ORDER BY NAME;

Which returns LAST_NAME to NAME in the event that FIRST_NAME is NULL.

I would prefer to use the Criteria API but could use HQL if there’s no other way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:44:10+00:00Added an answer on May 22, 2026 at 1:44 am

    Ended up adding a formula for it:

    <property name="name" formula="coalesce(first_name, last_name)"/>
    

    I’m concerned about cross-database problems and possibly efficiency problems with this approach so I’m willing to change the accepted answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create an equivalent if this Java method as PL/SQL function
Is there an Oracle NVL function equivalent in JavaScript/jQuery. I would be interested to
What would be equivalent of Number(4) of Oracle database to MySQL Datatype ?
How would I create the equivalent Linq To Objects query? SELECT MIN(CASE WHEN p.type
How would I execute a query equivalent to select top 10 in couch db?
I've been looking for a good equivalent to the Oracle LEAST function. I'm hoping
What would be equivalent of the below code in simple scriptlet code: <select name=dropdown>
I need to create a DataGridColumn from code. The XAML equivalent would be: <data:DataGridTemplateColumn
I'm coming from a SQL Server background. What would the equivalent data types be
I was wondering if there is an equivalent in SQL Server 2008 to Oracle's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.