Package br.com.caelum.stella.hibernate.example

Examples of br.com.caelum.stella.hibernate.example.ModeloDAO


    return modeloValido;
  }

  private static void listaModelosPersistidos() {
    Session session = HibernateUtil.getSessionFactory().openSession();
    ModeloDAO dao = new ModeloDAO(session);
    System.out.println("Listagem de modelos persistidos:");
    for (Modelo modelo : dao.listAll()) {
      System.out.println("\t" + modelo);
    }
  }
View Full Code Here


  }

  private static void save(Modelo modelo) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();
    ModeloDAO dao = new ModeloDAO(session);
    try {
      dao.save(modelo);
      System.out.println("Modelo válido: " + modelo);
      session.getTransaction().commit();
    } catch (InvalidStateException e) {
      System.out.println("Modelo inválido: " + modelo);
      System.out.println("Listagem das mensagens de validação (obtidas do arquivo ValidatorMessages.properties):");
View Full Code Here

TOP

Related Classes of br.com.caelum.stella.hibernate.example.ModeloDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.