Example usage for org.hibernate Session clear

List of usage examples for org.hibernate Session clear

Introduction

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

Prototype

void clear();

Source Link

Document

Completely clear the session.

Usage

From source file:com.elearing.impl.ChapterImageDaoImpl.java

@Override
public boolean insert(ChapterImage obj) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();/*from   www  .ja va 2s .  c om*/
    session.save(obj);
    session.getTransaction().commit();
    session.close();
    session.clear();
    return true;//To change body of generated methods, choose Tools | Templates.
}

From source file:com.elearing.impl.ChapterImageDaoImpl.java

public List<ChapterImage> getListByNameChapter(SubChapter obj) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();/* w ww .j a v a2  s. c  o  m*/
    Query qr = session.createQuery("from ChapterImage where subChapter =:chap");
    qr.setParameter("chap", obj);
    List<ChapterImage> list = qr.list();
    session.clear();
    session.close();
    return list;
}

From source file:com.elearing.impl.ChapterTypeDaoImpl.java

@Override
public boolean insert(ChapterType obj) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();/* ww  w.j  a  va2  s  . c o m*/
    session.save(obj);
    session.getTransaction().commit();
    session.clear();
    session.close();
    return true;

}

From source file:com.elearing.impl.ClassInfoDaoImpl.java

@Override
public boolean insert(ClassInfo obj) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();/*  w ww.  jav a 2s.  c o m*/
    session.save(obj);
    session.getTransaction().commit();
    session.clear();
    session.close();
    return true;

}

From source file:com.elearing.impl.ClassInfoDaoImpl.java

@Override
public boolean update(ClassInfo obj) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();//from   w w  w .j a va  2 s.  c  o  m
    session.update(obj);
    session.getTransaction().commit();
    session.clear();
    session.close();
    return true;
}

From source file:com.elearing.impl.ClassInfoDaoImpl.java

@Override
public boolean delete(ClassInfo obj) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();/*from www  . j  av  a 2  s. c  om*/
    session.delete(obj);
    session.getTransaction().commit();
    session.clear();
    session.close();
    return true; //To change body of generated methods, choose Tools | Templates.
}

From source file:com.elearing.impl.ClassInfoDaoImpl.java

@Override
public ClassInfo getObjectById(int id) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();//from  w  ww.java  2s .  c  om
    ClassInfo info = (ClassInfo) session.get(ClassInfo.class, id);
    session.clear();
    session.close();
    return info;
}

From source file:com.elearing.impl.ClassInfoDaoImpl.java

@Override
public List<ClassInfo> getAllObject() {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();/*from   w w  w .ja v a  2s.  c o m*/
    Query qr = session.createQuery("from ClassInfo");
    List<ClassInfo> list = qr.list();
    session.clear();
    session.close();
    return list;
}

From source file:com.elearing.impl.DescQuesDaoImpl.java

@Override
public boolean insert(DescQues obj) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();//w ww.ja  va2s .c o m
    session.save(obj);
    session.getTransaction().commit();
    session.clear();
    session.close();
    return true;//To change body of generated methods, choose Tools | Templates.
}

From source file:com.elearing.impl.DescQuesMetaDaoImpl.java

@Override
public boolean insert(DescQuesMeta obj) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    session.beginTransaction();/* w w  w.ja va 2s .  co  m*/
    session.save(obj);
    session.getTransaction().commit();
    session.clear();
    session.close();
    return true;//To change body of generated methods, choose Tools | Templates.
}