Hibernate Job Interview Questions

Answer  
# 1 Both of these methods and saveOrUpdate() method are intended for reattaching a detached object. The session.lock() method simply reattaches the object to the session without checking or updating the database on the assumption that the database in sync with the detached object. It is the best practice to use either session.update(..) or session.saveOrUpdate(). Use session.lock() only if you are absolutely sure that the detached object is in sync with your detached object or if it does not matter because you will be overwriting all the columns that would have changed later on within the same transaction.

Note: When you reattach detached objects you need to make sure that the dependent objects are reatched as well.
Answer Submitted by: Admin
Is This Answer Correct?    4 Yes 6 No
Submit New Question Place Your Answer

Previous Interview QuestionNext Interview Question
What is the difference between the session.get() method and the session.load() method?How would you reatach detached objects to a session when the same object has already been loaded into the session?

Top: What is the difference between the session.update() method and the session.lock() method?
Hibernate Job Interview Question


Top Frequently Asked Hibernate Question
Frequently Asked Hibernate Job Interview Question


Top Frequently opened Java Programing Job Interview categories
Most popular Java Programing Job Interview categories

Comments About What is the difference between the session.update() method and the session.lock() method?

Share your valuable opinions, ideas and suggestions about What is the difference between the session.update() method and the session.lock() method?
While placing your comment your email address is required but won't be published any where else; Personal information will be kept confidential; we do not sell or release our respective visitors private information.
  1. Webmaster 23rd of May 2012

    Webmaster Said

    Tell us what you feel about What is the difference between the session.update() method and the session.lock() method?
    All comments will be published after review. No login or registration is required to post a comment on What is the difference between the session.update() method and the session.lock() method? We offer and invite you to submit your valuable comment now; Please be respectful of others when commenting. Insulting others, self-promotional comments, website promotional comments, marketing stuff, SEO Techniques, SMS-style content and off-topic comments will not be approved at this information portal.
    So start sharing your thoughts regarding What is the difference between the session.update() method and the session.lock() method?
    Thank you.

Leave a Comment

Leave a Comment
  1.  Enter This Verification Code  Regenerate Verification Code  



Your reply will be added to the comment above (Below any other replies to this comment) -

Top Comments About: What is the difference between the session.update() method and the session.lock() method?
Comments on What is the difference between the session.update() method and the session.lock() method?

 
Top of Link batk to What is the difference between the session.update() method and the session.lock() method?
Link batk to What is the difference between the session.update() method and the session.lock() method?