Example usage for org.hibernate Session update

List of usage examples for org.hibernate Session update

Introduction

In this page you can find the example usage for org.hibernate Session update.

Prototype

void update(Object object);

Source Link

Document

Update the persistent instance with the identifier of the given detached instance.

Usage

From source file:cn.newtouch.model.TeacherTest.java

License:Open Source License

@Test
public void testUpdate1() {

    Session session = HibernateUtil.getSession();
    session.beginTransaction();/* w ww. j  a va  2s  . c  o  m*/
    Teacher t = (Teacher) session.get(Teacher.class, 1);

    session.getTransaction().commit();

    t.setName("zhanglaoshi");

    Session session2 = HibernateUtil.getSession();
    session2.beginTransaction();
    session2.update(t);

    session2.getTransaction().commit();
}

From source file:cn.newtouch.model.TeacherTest.java

License:Open Source License

@Test
public void testUpdate2() {

    Teacher t = new Teacher();
    t.setName("zhanglaoshi");

    Session session2 = HibernateUtil.getSession();
    session2.beginTransaction();/*w  w  w .  j  a va  2  s . co m*/
    session2.update(t);

    session2.getTransaction().commit();
}

From source file:cn.newtouch.model.TeacherTest.java

License:Open Source License

@Test
public void testUpdate3() {

    Teacher t = new Teacher();
    t.setId(1);//  w  w w  . jav  a  2 s .  c  o m
    t.setName("zhanglaoshi");

    Session session2 = HibernateUtil.getSession();
    session2.beginTransaction();
    session2.update(t);

    session2.getTransaction().commit();
}

From source file:cn.newtouch.model.TeacherTest.java

License:Open Source License

@Test
public void testUpdate5() {

    Session session = HibernateUtil.getSession();
    session.beginTransaction();//from w  w  w.j  a v  a  2s  . c o m
    Student s = (Student) session.get(Student.class, 1);
    s.setName("zhangsan5");
    session.getTransaction().commit();

    s.setName("z4");

    Session session2 = HibernateUtil.getSession();
    session2.beginTransaction();
    session2.update(s);
    session2.getTransaction().commit();
}

From source file:cn.sharek.bsg.machine.dao.impl.DMLDaoImpl.java

@Override
public void update(T entity, Session session) throws Exception {
    session.update(entity);
}

From source file:co.com.edu.udea.micine.DAO.impl.CineDAOImpl.java

@Override
public void editarCine(Cine c) {
    Session session = this.sessionFactory.openSession();
    Transaction tx = session.beginTransaction();
    session.update(c);
    tx.commit();//from  www.j  a  va2s  .c o  m
    session.close();
}

From source file:co.com.edu.udea.micine.DAO.impl.FormatoDAOImpl.java

@Override
public void editarFormato(Formato c) {
    Session session = this.sessionFactory.openSession();
    Transaction tx = session.beginTransaction();
    session.update(c);
    tx.commit();/*w w w . ja  v a  2 s.co m*/
    session.close();
}

From source file:co.com.edu.udea.micine.DAO.impl.LocalidadDAOImpl.java

@Override
public void editarLocalidad(Localidad c) {
    Session session = this.sessionFactory.openSession();
    Transaction tx = session.beginTransaction();
    session.update(c);
    tx.commit();//from   www . jav  a2 s  . com
    session.close();
}

From source file:co.com.edu.udea.micine.DAO.impl.OperadorDAOImpl.java

@Override
public void editarOperador(Operador o) {
    Session session = this.sessionFactory.openSession();
    Transaction tx = session.beginTransaction();
    session.update(o);
    tx.commit();/*from  w  w w .  j ava2s  .co m*/
    session.close();
}

From source file:co.com.edu.udea.micine.DAO.impl.SocioDAOImpl.java

@Override
public void editarSocio(Socio c) {
    Session session = this.sessionFactory.openSession();
    Transaction tx = session.beginTransaction();
    session.update(c);
    tx.commit();//from  www. j  a  v a 2s .c  o m
    session.close();
}