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.actop.model.ApprovalManagement.java

public ProjectTasksApproval saveProjectTasksApprovel(Date date, DepartmentsHasDesignation dhd, String note,
        ProjectTasks ptask, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    ProjectTasksApproval approval = new ProjectTasksApproval();
    try {/* w w  w .j  ava  2 s.  co m*/
        approval.setApprovedtime(date);
        approval.setDepartmentsHasDesignation(dhd);
        approval.setNote(note);
        approval.setProjectTasks(ptask);
        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 ProjectTasksApproval getProjectTaskApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    ProjectTasksApproval projectTaskapproval = (ProjectTasksApproval) s.load(ProjectTasksApproval.class, id);
    s.flush();
    s.close();// www .ja va  2 s.c om
    return projectTaskapproval;
}

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

public ProjectTasksApproval approveProjectTask(int id, String note, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    ProjectTasksApproval approval = (ProjectTasksApproval) s.load(ProjectTasksApproval.class, id);
    Transaction t = s.beginTransaction();
    try {/* www.ja v a2s.c om*/
        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;
}

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

public AllowanceApproval saveAllowanceApproval(Date date, DepartmentsHasDesignation dhd,
        EmployersHasAllowances emp, String note, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    AllowanceApproval approval = new AllowanceApproval();
    try {// ww w  .  ja  v  a2s.com
        approval.setApprovedtime(date);
        approval.setDepartmentsHasDesignation(dhd);
        approval.setEmployersHasAllowances(emp);
        approval.setNote(note);
        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 AllowanceApproval getAllowanceApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    AllowanceApproval allowanceApproval = (AllowanceApproval) s.load(AllowanceApproval.class, id);
    s.flush();
    s.close();//from ww w  .j  av  a 2  s . co  m
    return allowanceApproval;
}

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

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

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

public OtherApprovals saveOtherApproval(Date date, DepartmentsHasDesignation dhd, String note, Other other,
        Integer status) {/*w w  w.j  a  v a2s .c om*/
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    OtherApprovals approvals = new OtherApprovals();
    try {
        approvals.setApprovedtime(date);
        System.out.println(dhd.getIdDepartmentsHasDesignation() + "");
        approvals.setDepartmentsHasDesignation(dhd);
        approvals.setNote(note);
        approvals.setOther(other);
        approvals.setStatus(status);
        s.save(approvals);
    } catch (Exception e) {
        e.printStackTrace();
        t.rollback();
    }
    t.commit();
    s.flush();
    s.close();
    return approvals;
}

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

public OtherApprovals getOtherApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    OtherApprovals otherApproval = (OtherApprovals) s.load(OtherApprovals.class, id);
    s.flush();
    s.close();//from w  ww.ja  v  a  2  s  .  co m
    return otherApproval;
}

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

public OtherApprovals approveOther(int id, String note, Integer status) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    OtherApprovals approvals = (OtherApprovals) s.load(OtherApprovals.class, id);
    try {/*  w w  w .  j a  v  a 2 s . c o m*/
        approvals.setApprovedtime(new Date());
        approvals.setNote(note);
        approvals.setStatus(status);
    } catch (Exception e) {
        e.printStackTrace();
        t.rollback();
    }
    t.commit();
    s.flush();
    s.close();
    return approvals;
}

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

public Attendance saveAttendance(Date attendanceDate, Date dattime, Employers emp) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    Attendance a = new Attendance();
    try {/*from  w w  w.j  a  v a2 s  . c  o m*/
        a.setAttendanceDate(attendanceDate);
        a.setDateTime(dattime);
        a.setEmployers(emp);
    } catch (Exception e) {
        t.rollback();
        e.printStackTrace();
    }
    s.flush();
    s.close();
    return a;
}