Java tutorial
/* * 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. */ package br.com.gesteduc.administrador; import br.com.gesteduc.util.HibernateUtil; import org.hibernate.Session; import org.hibernate.Transaction; /** * * @author Johnatan */ public class AdministradorDao { public void salvar(Administrador administrador) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction t = session.beginTransaction(); session.save(administrador); t.commit(); } }