Java tutorial
import model.entity.Supplier; import org.hibernate.Session; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author LapTop */ public class TestUpdate { public static void main(String[] args) { Supplier entity = new Supplier(); entity.setId(9); entity.setName("Test"); entity.setNote("bbbbb"); Session ses = utils.HibernateUtils.getSessionFactory().getCurrentSession(); try { ses.beginTransaction(); ses.update(entity); ses.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); ses.getTransaction().rollback(); } } }