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.save() , session.saveOrUpdate() and session.persist()?

!!!Answer!!!- From Technical Expert

session.save() : Save does an insert and will fail if the primary key is already persistent.

session.saveOrUpdate() : saveOrUpdate does a select first to determine if it needs to do an insert or an update.
Insert data if primary key not exist otherwise update data.

session.persist() : Does the same like session.save().
But session.save() return Serializable object but session.persist() return void.
         session.save() returns the generated identifier (Serializable object) and session.persist() doesn't.
For Example :
         if you do :-
         System.out.println(session.save(question));
         This will print the generated primary key.
         if you do :-
         System.out.println(session.persist(question));
         Compile time error because session.persist() return void.

Answered By : manoj Replied Date : Jul 1 2008
Answer : session.saveOrUpdate() : saveOrUpdate does a select first to determine if it needs to do an insert or an update.
Insert data if primary key not exist otherwise update data.

session.persist() : Does the same like session.save().
But session.save() return Serializable object but session.persist() return void.
session.save() returns the generated identifier (Serializable object) and session.persist() doesn't.


Answered By : Umakant Kaushik Replied Date : Feb 9 2012
Answer : No Comments


Answered By : Motilal Replied Date : Dec 29 2010
Answer : This helps a lot for begineer


Answered By : Jitendra Replied Date : Nov 11 2010
Answer :
session.persist() : Does the same like session.save().
But session.save() return Serializable object but session.persist() return void.
session.save() returns the generated identifier (Serializable object) and session.persist() doesn't.

www.javaprogrammings.info


Answered By : sadf Replied Date : Sep 4 2010
Answer : asdf


Answered By : s Replied Date : May 2 2012
Answer : a


Answered By : null Replied Date : Dec 28 2013
Answer :


Answered By : null Replied Date : Dec 21 2013
Answer :


Answered By : null Replied Date : Dec 21 2013
Answer :


Answered By : null Replied Date : Dec 9 2013
Answer :


Answered By : null Replied Date : Dec 4 2013
Answer :


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


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


Answered By : null Replied Date : Mar 9 2014
Answer :


Answered By : null Replied Date : Mar 16 2014
Answer :


Answered By : null Replied Date : May 6 2014
Answer :


Answered By : null Replied Date : Jul 6 2014
Answer :


Answered By : sreenu Replied Date : Aug 18 2014
Answer : save() method always exists it means we have use
primary key in our object database stored
persist() method only normal objects database stored


Answered By : sreenu Replied Date : Aug 18 2014
Answer : save() method always exists it means we have use
primary key in our object database stored
persist() method only normal objects database stored


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


Answered By : null Replied Date : Jun 27 2015
Answer :


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


Answered By : null Replied Date : Mar 21 2016
Answer :


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


Answered By : null Replied Date : Feb 12 2017
Answer :


Answered By : null Replied Date : Feb 16 2017
Answer :


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


Answered By : null Replied Date : Jun 12 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