Example usage for org.hibernate SessionFactory openSession

List of usage examples for org.hibernate SessionFactory openSession

Introduction

In this page you can find the example usage for org.hibernate SessionFactory openSession.

Prototype

Session openSession() throws HibernateException;

Source Link

Document

Open a Session .

Usage

From source file:com.Accenture.DAO.feedbackDao.java

public void deleteforceg(feedbackpojo f) {
    Session session = null;//w ww. jav a  2  s  .  c  o m
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();

    session.delete(f);
    session.getTransaction().commit();
    session.flush();
    session.close();
}

From source file:com.Accenture.DAO.feedbackDao.java

public List<feedbackpojo> findlocandgro(String email) {
    List<feedbackpojo> list = new ArrayList<>();
    Session ses = null;/*from w w w  .  j a  va 2 s. c om*/
    SessionFactory sf = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    ses = sf.openSession();
    ses.beginTransaction();
    String HQL_QUERY = "from feedbackpojo feedback where email =:email";
    org.hibernate.Query query = ses.createQuery(HQL_QUERY);
    query.setParameter("email", email);
    for (Iterator it = query.iterate(); it.hasNext();) {
        feedbackpojo b = (feedbackpojo) it.next();
        b.getEmail();
        list.add(b);
    }
    return list;
}

From source file:com.Accenture.DAO.feedbackDao.java

public List<feedbackpojo> search0(String em) {
    List<feedbackpojo> result = new ArrayList<feedbackpojo>();
    Session session = null;// w  ww.j  a  v  a 2s . co m
    SessionFactory sessionfactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionfactory.openSession();
    session.beginTransaction();

    String HQL_QUERY = "from feedbackpojo feedback where email='" + em + "'";
    org.hibernate.Query query = session.createQuery(HQL_QUERY);

    for (Iterator it = query.iterate(); it.hasNext();) {
        feedbackpojo f = (feedbackpojo) it.next();

        f.getFeedbackid();
        f.getLid();
        f.getFeedback();
        f.getEmail();
        result.add(f);
    }
    return result;
}

From source file:com.Accenture.DAO.groupDao.java

public void updateforceg(grouppojo e) {
    Session session = null;/* w  w w.  ja  v a 2s  .  c  o  m*/
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();

    session.update(e);
    session.getTransaction().commit();
    session.flush();
    session.close();
}

From source file:com.Accenture.DAO.groupDao.java

public void deleteforceg(grouppojo e) {
    Session session = null;/*from  ww w  .j  a  v  a  2  s  .  c o  m*/
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();

    session.delete(e);
    session.getTransaction().commit();
    session.flush();
    session.close();
}

From source file:com.Accenture.DAO.groupDao.java

public List<grouppojo> search(String search) {
    List<grouppojo> result = new ArrayList<grouppojo>();
    Session session = null;/*from  www  .ja  va2 s. c  om*/
    SessionFactory sessionfactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionfactory.openSession();
    session.beginTransaction();

    String HQL_QUERY = "from grouppojo groups where gname like '" + search + "%'";
    org.hibernate.Query query = session.createQuery(HQL_QUERY);

    for (Iterator it = query.iterate(); it.hasNext();) {
        grouppojo l = (grouppojo) it.next();

        l.getDuration();
        l.getFinish();
        l.getGname();
        l.getGroupid();
        l.getLocation();
        l.getStart();
        result.add(l);
    }
    return result;
}

From source file:com.Accenture.DAO.LearnerAssessmentDAO.java

public void updateforce(LearnerAssessmentPojo l) {
    Session session = null;/*from   ww  w  . j  a v a  2 s.  c  om*/
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();

    session.update(l);
    session.getTransaction().commit();
    session.flush();
    session.close();
}

From source file:com.Accenture.DAO.LearnerAssessmentDAO.java

public void deleteforce(LearnerAssessmentPojo l) {
    Session session = null;//from   ww  w  . j a  v a2  s .co  m
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();

    session.delete(l);
    session.getTransaction().commit();
    session.flush();
    session.close();
}

From source file:com.Accenture.DAO.learnerDao.java

public void updateLearner(learnerspojo e) {
    Session session = null;/*w w w  .j ava 2  s  .  co m*/
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();

    session.update(e);
    session.getTransaction().commit();
    session.flush();
    session.close();

}

From source file:com.Accenture.DAO.learnerDao.java

public void deleteLearner(learnerspojo e) {
    Session session = null;/*from  w w  w . jav  a2  s. c o m*/
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();

    session.delete(e);
    session.getTransaction().commit();
    session.flush();
    session.close();
}