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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:06:29+00:00 2026-05-28T02:06:29+00:00

I am reading about HibernateTemplate class in Spring3. Here i saw two methods update

  • 0

I am reading about HibernateTemplate class in Spring3.

Here i saw two methods update and saveOrUpdate , i read it from the documentation such as

  • update

Update the given persistent instance, associating it with the current Hibernate Session.

Here what is meaning of “associating it with the current Hibernate Session”?

  • saveOrUpdate

Save or update the given persistent instance, according to its id (matching the configured “unsaved-value”?). Associates the instance with the current Hibernate Session.

Here what is meaning of “according to its id (matching the configured “unsaved-value”?). Associates the instance with the current Hibernate Session” ?

Please help me

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-28T02:06:30+00:00Added an answer on May 28, 2026 at 2:06 am

    Simple – If the object with the same ID exists in the DB , it updates it else if the ID (primary key) is null, it saves it as a new value – Hence saveOrUpdate – depending on whether it’s a value existing in DB or a new value.

    The ID match happens by matching your pojo ID in the hbm under the tag with the column specified .

    saveOrUpdate() does the following:

    if the object is already persistent in this session, do nothing
    
    if another object associated with the session has the same identifier, throw an exception
    
    if the object has no identifier property, save() it
    
    if the object's identifier has the value assigned to a newly instantiated object, save() it
    
    if the object is versioned by a <version> or <timestamp>, and the version property value is the same value assigned to a newly instantiated object, save() it
    
    otherwise update() the object 
    

    From here

    Hope this helps.

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

Sidebar

Related Questions

After reading about dynamic class loading (that is, loading a .class file from disk)
Reading about the Dispose pattern , I see the documentation repeatedly refer to cleaning
Reading about Kohana templates and saw something I've never seen before: $this->template->title = __('Welcome
Reading about Django, I saw this: http://docs.djangoproject.com/en/1.1/ref/contrib/admin/#ref-contrib-admin - the fancy simple to use admin
I was reading about output buffering in JavaScript here , and was trying to
While reading about constant interface antipattern, i found final constant class with no instances
After reading about the System.Diagnostics.Contracts.Contract static class that has been influenced by the awesomeness
Reading about the problem of creating a read only primitive vector in C# (basically,
When reading about JQuery best practices, I read this recently: Never include Javascript events
while reading about declare construct from php manual i tried the following example using

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.