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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:53:31+00:00 2026-05-27T22:53:31+00:00

In my project, some time I have to load a object to edit them.

  • 0

In my project, some time I have to load a object to edit them.
Before this, I think, hibernate session is closed.

Some time before save the edited object (with saveOrUpdate), I have to search (open session again) for a object in the database, and, maybe, the object returned by this search is the object I’ll update. (I need this object for some validations and other things…)

After this, when I try to save the object, hibernate says that I have another object with the same identifier in the session.

I have implemented my own equals and hashcode methods, and I tried to do somethings, like session.evict(object), but, nothing works.

So, I use session.merge(object) instead of session.saveOrUpdate(object), and it works.
But, I dont know exactly what is the consequences of doing this. I can simple replace saveOrUpdate by merge, or I will get some issues with it? Another thing I have to know about this?

Thanks in advance.

  • 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-27T22:53:32+00:00Added an answer on May 27, 2026 at 10:53 pm

    i think this is a duplicate for What are the differences between Hibernate Session methods saveOrUpdate() and merge()?
    and a number of other questions, very common question indeed…

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

Sidebar

Related Questions

I have been working with Struts for some time, but for a project I
I have a project that comprises pre-build Dll modules, built some time in the
Some time ago I got this error when building ANY Visual Studio Deployment project.
I have been using jQuery for some time and this one's stumping me- I
This is a homework project I was assigned some time ago... I've been successful
I have some projects for which I have ceased development a long time ago
Some time ago I joined new project. It was under development for quite a
I've spent some time with new Database project in VS 2008 and decided to
I've got a WinForms project that I've had for quite some time, and now
I made some changes to an open source project without taking time to create

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.