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 9188737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:05:10+00:00 2026-06-17T20:05:10+00:00

It seems that the Hibernate EntityManager find method behaves differently in the following two

  • 0

It seems that the Hibernate EntityManager find method behaves differently in the following two cases:

Case 1 – Entity does not exist in the database before transaction starts. Within transaction, find of the entity returns null.

Case 2 – Entity exists in DB before transaction. Within transaction, entity is remove‘d, then a find of the same key throws EntityNotFoundException.

Is this expected behaviour? Do I need to do a flush before the find for it to behave the same?

  • 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-17T20:05:12+00:00Added an answer on June 17, 2026 at 8:05 pm

    It is unexpected that find method in EntityManager throws EntityNotFoundException when entity is not found. Documentation is quite clear:

    Returns:
    the found entity instance or null if the entity does not exist

    This bug was reported in HHH-7861. It is fixed in 4.1.10, which is not yet released.

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

Sidebar

Related Questions

It seems that NHibernate Linq doesn't understand grouped .Where method conditions. I got the
It seems that often I find that my code when moving either from one
It seems that it is not advisable to use <meta http-equiv=REFRESH CONTENT=3;url=url> for redirects
It seems that org.hibernate.cfg.Configuration object can be used to perform validation programmatically, by calling
I've inherited a hibernate application and I've run into issues. It seems that the
We are using Hibernate with Spring for our Java application. We find out that
I am new in hibernate,after read the hibernate api and tutorial,it seems that the
I'm new to Spring, using version 3.2 with Hibernate 4.1.9Final, it seems that @Transactional
Seems that This will be an easy question for you but this problem is
Seems that even after unchecking the option in the PyDev/Debug preferenecs pane to launch

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.