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

  • SEARCH
  • Home
  • 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 8886589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:35:39+00:00 2026-06-14T21:35:39+00:00

In Hibernate query how do i check if a property is null? Depending on

  • 0

In Hibernate query how do i check if a property is null? Depending on the result i want to fetch that property and if it is not null i have to fetch another property.

  • 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-06-14T21:35:40+00:00Added an answer on June 14, 2026 at 9:35 pm

    Following two ways are valid HQL queries and both are also valid JPA 2.0 JPQL queries.

    Using coalesce (returns first non-null, or null if both are null):

    SELECT coalesce(e.property, e.otherProperty) FROM SomeEntity e
    

    Equivalent select-case, which is bit longer:

    SELECT CASE WHEN e.property IS NULL THEN e.otherProperty ELSE e.property END 
    FROM SomeEntity e
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an entity which has a property that does not get its value
During performing some performance tuning in my application I have noticed, that hibernate query
I have a problem with a query using hibernate. The entity class EntityClass has
When using Hibernate 2nd level cache and query cache and not specifying anything inside
I have inherited a bit of Java code that uses Hibernate. Some of the
I have the following tables: USER ID VARCHAR(32) INTEGER NOT NULL ROLE ID INTEGER
I have hibernate session query using a class recognized by hibernate. This query runs
Why does this query NOT work FROM WorkflowConfiguration WHERE ((saReplacement IS NOT NULL) AND
I have Login Table that have utf8 charset and utf8 collation when I want
I'm using Hibernate Query by Example (QbE) with a pojo that has a lot

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.