
How to update value of database using hibernate ?

Hi Samar,
With the help of this code, you will see how can update database using hibernate.
package net.roseindia.DAO;
import net.roseindia.hibernateUtil.HibernateUtil;
import net.roseindia.model.EmployeeInfo;
import org.hibernate.classic.Session;
public class UpdateDao {
public EmployeeInfo updateData(EmployeeInfo obInfo) {
System.out.println("ID " + obInfo.getId());
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.update(obInfo);
session.getTransaction().commit();
return obInfo;
}
}
Thanks...........
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.