use of com.tomasio.projects.trainning.dao.HibernatePessoaDAO in project trainning by fernandotomasio.
the class TestCursos method main.
public static void main(String[] args) throws DAOException {
HibernatePessoaDAO dao = new HibernatePessoaDAO();
SessionFactory factory = HibernateUtil.getSessionFactory();
dao.setSessionFactory(factory);
Session session = factory.openSession();
Transaction tx = session.beginTransaction();
List<Pessoa> pessoas = dao.search("042.745.547-24", null);
for (Pessoa pessoa : pessoas) {
System.out.println(pessoa.getNome());
}
tx.commit();
session.close();
}
Aggregations