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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:51:53+00:00 2026-05-26T15:51:53+00:00

If you load an entity from db and modify it somehow, will hibernate use

  • 0

If you load an entity from db and modify it somehow, will hibernate use equals/hashCode to compare current state of entity with it’s snapshot to determine if sql update needs to be performed?

If it does such comprasions, I have another question: if equals will return true, will hibernate think that entity did not changed or attempt to use it’s default comprasion (to be sure)?

  • 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-26T15:51:53+00:00Added an answer on May 26, 2026 at 3:51 pm

    Please see Equals and HashCode from the JBoss Community website. From there:

    To avoid this problem we recommend using the “semi”-unique attributes
    of your persistent class to implement equals() (and hashCode()).
    Basically you should think of your database identifier as not having
    business meaning at all (remember, surrogate identifier attributes and
    automatically generated vales are recommended anyway). The database
    identifier property should only be an object identifier, and basically
    should be used by Hibernate only. Of course, you may also use the
    database identifier as a convenient read-only handle, e.g. to build
    links in web applications.

    In other words, Hibernate uses equals and hashCode for identity, not to see if an object has been modified. It uses attribute by attribute comparisons for that.

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

Sidebar

Related Questions

I'm writing a little utility to load Entity Data Models from an assembly and
I have an entity loaded by Hibernate (via EntityManager ): User u = em.load(User.class,
How do I load an EntityCollection or List(Of Entity) from a DataTable using LLBLGen?
I am trying to load an entity with byte data (annotated with @Lob) from
What problems will I have if I change my Entity Framework queries from this:
I load a UIWebView from a string in a navigation based app. I'm using
ViewA load some data from Coredata, then push to the next viewB . In
I try to load an entity with some details and there is a resellerId
sesion.Get(id); produces sometimes a GenericADOException: could not load an entity: [PFC__ Servidor.Entidades.Usuario#10][SQL: SELECT usuario0
I have working app1.ear , containing: JPA entity, MyObjectImpl , implementing interface MyObject from

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.