1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)
 

Recent Questions

!!! Hibernate Frequently Asked Questions !!!

Difference between session.saveOrUpdate() and session.merge();

!!!Answer!!!- From Technical Expert

<b>saveOrUpdate() </b>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

<b>merge() </b>is very different:
? if there is a persistent instance with the same identifier currently associated with the session, copy the state
of the given object onto the persistent instance
? if there is no persistent instance currently associated with the session, try to load it from the database, or
create a new persistent instance
? the persistent instance is returned
? the given instance does not become associated with the session, it remains detached

Answered By : Ajay Kumar Replied Date : Sep 6 2011
Answer : If the object is in detached State we will use merge else we will go for update.


Answered By : null Replied Date : Jan 30 2014
Answer :


Answered By : null Replied Date : Nov 1 2013
Answer :


Answered By : null Replied Date : Nov 1 2013
Answer :


Answered By : null Replied Date : Oct 14 2013
Answer :


Answered By : null Replied Date : Feb 14 2014
Answer :


Answered By : null Replied Date : Apr 5 2014
Answer :


Answered By : null Replied Date : Apr 29 2014
Answer :


Answered By : null Replied Date : Aug 15 2014
Answer :


Answered By : null Replied Date : Nov 30 2014
Answer :


Answered By : null Replied Date : Jan 24 2015
Answer :


Answered By : null Replied Date : Feb 20 2015
Answer :


Answered By : null Replied Date : Jul 1 2015
Answer :


Answered By : null Replied Date : Feb 29 2016
Answer :


Answered By : null Replied Date : Apr 19 2016
Answer :


Answered By : null Replied Date : Oct 1 2016
Answer :


Answered By : null Replied Date : Jun 10 2017
Answer :


 

You can also contribute to this answer:

Your Name:
Answer:

 
Ask Question and get answer from Expert.
View Answers List from Expert.

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy