|Home |Login |Registration |Struts Step by Step Tutorial |Hibernate Step by Step Tutorial |Spring Step by Step Tutorial |JSP Step by Step Tutorial |JDBC Step by Step Tutorial |Web Services Step by Step Tutorial |EJB fundamentals | ORACLE Step by Step Tutorial | SCJP 5.0 and SCJP 6.0 Study Guide | SCWCD 5.0 Study Guide | SCJP Tips
Java mock test | SCJP mock test | SCJP DUMP | SCBCD mock test | SCWCD mock test | JSP mock test | ORACLE mock test | OCP mock test | Hibernate mock test | Servlet mock test | Struts mock test | EJB mock test | C mock test | C++ mock test | Aptitude mock test | PMP mock test Exam |Java online test exam | JSP online test exam | ORACLE online test exam | Hibernate online test exam | Servlet online test exam | Struts online test exam | EJB online test exam | C online test exam | C++ online test exam | Aptitude online test exam

Download java,jsp,servlet,hibernate,spring,jdbc,jms,struts,EJB,oracle,c,c++,informatica interview questions and answers in pdf format


Download 1600 PMP Questions Free


Download 800 SCJP Questions Free


Download 600 SCWCD Questions Free

Ads

Free ERP Customization

                                                                                                                                                    
Add/View Reviews , Comments

Hibernate interview questions

!!! Hibernate interview questions !!!

Difference between session.save() , session.saveOrUpdate() and session.persist()?


SCJP 1.5/1.6 Exam Kit

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.
The information you are posting should be related to java and ORACLE technology. Not political. Your Ad Here