Example usage for org.hibernate Session flush

List of usage examples for org.hibernate Session flush

Introduction

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

Prototype

void flush() throws HibernateException;

Source Link

Document

Force this session to flush.

Usage

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

public void deleteforce(trainerpojo l) {
    Session session = null;
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();//w w  w  .j  a v a2s .c  o m

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

From source file:com.actop.model.ApprovalManagement.java

public PaymentApproval savePaymentApproval(Date aptime, DepartmentsHasDesignation depahasdes, String note,
        Payments payment, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    s.update(depahasdes);//from w ww .  jav a2s  .c  o m
    Transaction t = s.beginTransaction();
    PaymentApproval approval = new PaymentApproval();
    //        System.out.println("AWAAA"+depahasdes+""+payment+"");
    try {
        approval.setApprovedtime(aptime);
        approval.setDepartmentsHasDesignation(depahasdes);
        approval.setNote(note);
        approval.setPayments(payment);
        approval.setStatus(status);
        s.save(approval);
    } catch (Exception e) {
        e.printStackTrace();
        t.rollback();
    }
    t.commit();
    s.flush();
    s.close();
    return approval;
}

From source file:com.actop.model.ApprovalManagement.java

public PaymentApproval approvePayment(int id, String note, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    PaymentApproval approval = (PaymentApproval) s.load(PaymentApproval.class, id);
    Transaction t = s.beginTransaction();
    try {//from  w ww . j a va2  s .c o m
        approval.setApprovedtime(new Date());
        approval.setNote(note);
        approval.setStatus(status);
        s.update(approval);
    } catch (Exception e) {
        e.printStackTrace();
        t.rollback();
    }
    t.commit();
    s.flush();
    s.close();
    return approval;
}

From source file:com.actop.model.ApprovalManagement.java

public PaymentApproval getPaymentApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    PaymentApproval paymentApproval = (PaymentApproval) s.load(PaymentApproval.class, id);
    s.flush();
    s.close();//from ww w.jav a  2  s .c o  m
    return paymentApproval;
}

From source file:com.actop.model.ApprovalManagement.java

public PromotionApproval savePromotionApproval(Date date, DepartmentsHasDesignation dhd, String note,
        Promotions promo, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    PromotionApproval approval = new PromotionApproval();
    try {/*from  w ww  . j a  va  2s .c  o m*/
        approval.setDatetime(date);
        approval.setDepartmentsHasDesignation(dhd);
        approval.setNote(note);
        approval.setPromotions(promo);
        approval.setStatus(status);
        s.save(approval);
    } catch (Exception e) {
        e.printStackTrace();
        t.rollback();
    }
    t.commit();
    s.flush();
    s.close();
    return approval;
}

From source file:com.actop.model.ApprovalManagement.java

public PromotionApproval approvePromotion(int id, String note, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    PromotionApproval approval = (PromotionApproval) s.load(PromotionApproval.class, id);
    try {/*ww  w . j  a  v a2s  . c om*/
        approval.setDatetime(new Date());
        approval.setNote(note);
        approval.setStatus(status);
    } catch (Exception e) {
        e.printStackTrace();
        t.rollback();
    }
    t.commit();
    s.flush();
    s.close();
    return approval;
}

From source file:com.actop.model.ApprovalManagement.java

public PromotionApproval getPromotionApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    PromotionApproval promotionapproval = (PromotionApproval) s.load(PromotionApproval.class, id);
    s.flush();
    s.close();/*from   w w  w  .  ja va  2 s .co  m*/
    return promotionapproval;
}

From source file:com.actop.model.ApprovalManagement.java

public ProjectsApproval saveProjectApproval(Date date, DepartmentsHasDesignation dhd, String note,
        Projects projects, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    ProjectsApproval approval = new ProjectsApproval();
    try {//from   w  w  w  .j  av a  2 s  .  c o  m
        approval.setApprovedtime(date);
        approval.setDepartmentsHasDesignation(dhd);
        approval.setNote(note);
        approval.setProjects(projects);
        approval.setStatus(status);
        s.save(approval);
    } catch (Exception e) {
        e.printStackTrace();
        t.rollback();
    }
    t.commit();
    s.flush();
    s.close();
    return approval;
}

From source file:com.actop.model.ApprovalManagement.java

public ProjectsApproval getProjectApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    ProjectsApproval projectapproval = (ProjectsApproval) s.load(ProjectsApproval.class, id);
    s.flush();
    s.close();/*from w w w  .  j  a  va 2  s. c  om*/
    return projectapproval;
}

From source file:com.actop.model.ApprovalManagement.java

public ProjectsApproval approveProject(int id, String note, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    ProjectsApproval approval = (ProjectsApproval) s.load(ProjectsApproval.class, id);
    try {/*from  w ww. ja v  a 2  s . co m*/
        approval.setApprovedtime(new Date());
        approval.setNote(note);
        approval.setStatus(status);
    } catch (Exception e) {
        e.printStackTrace();
        t.rollback();
    }
    t.commit();
    s.flush();
    s.close();
    return approval;
}