Package net.timwforce.dto

Examples of net.timwforce.dto.Student


  }


  private void doHibernateSimpleSave() {
    System.out.println("##### doHibernateSimpleSave - Starting ...");
    Student student = new Student();
    student.setName("John Doe");
    SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
    Session session = sessionFactory.openSession();
    session.beginTransaction();
    session.save(student);
    session.getTransaction().commit();
View Full Code Here


  private void doHibernateSimpleRead() {
    System.out.println("##### doHibernateSimpleRead - Starting ...");
    SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
    Session session = sessionFactory.openSession();
    Student student = (Student) session.get(Student.class, 2);
    System.out.println("##### doHibernateSimpleRead - student read: " + student.getName());
    session.close()
  }
View Full Code Here

  private void doHibernateSimpleDelete() {
    System.out.println("##### doHibernateSimpleDelete - Starting ...");
    SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
    Session session = sessionFactory.openSession();
    Student student = new Student();
    student.setName("Greg");

    session.beginTransaction();
    session.save(student);
    System.out.println("##### doHibernateSimpleDelete - student saved: name=" + student.getName() + "   id=" + student.getStudentId());
    session.getTransaction().commit();

    session.beginTransaction();
    session.delete(student);
    session.getTransaction().commit();

    System.out.println("##### doHibernateSimpleDelete - student deleted: " + student.getName());
    session.close()
  }
View Full Code Here

TOP

Related Classes of net.timwforce.dto.Student

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.