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 com.r3bl.dao; import com.r3bl.model.Diagnostico; import org.hibernate.Session; import org.hibernate.SessionFactory; /** * * @author Rafael Soares Pinto <rafaelsp.93@gmail.com> */ public class DiagnosticoDaoImpl implements DiagnosticoDao { private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sf) { this.sessionFactory = sf; } @Override public void addDiagnostico(Diagnostico d) { Session session = this.sessionFactory.getCurrentSession(); session.persist(d); } }