Easy learning with example program codes

What is the difference between session save and session persist method in hibernate?


1. Syntax: public Serializable save(Object object) throws HibernateException.
2. The return type of the save method is It returns the generated Id after saving the record.
3. It can save the changes to the database outside of the transaction. i.e. Save method can be used inside or outside the transaction.
4. for a detached object will create a new row in the table.
5. Save method takes more time to execute.


1. Syntax: public void persist(Object object) throws HibernateException.
2. It does not returns generated Id after saving. Its return type is void.
3. Persist method can be used only within the transaction.
4. session.persist() for a detached object will throw PersistentObjectException as it is not allowed.
5. Persist method takes less time to execute.

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki