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.ProjectsManagement.java

public List<Clients> getAllClients() {
    Session s = Connection.getSessionFactory().openSession();
    Criteria c = s.createCriteria(Clients.class);
    List<Clients> l = c.list();
    s.flush();
    s.close();//from   ww  w  .  ja va2s  . c om
    return l;
}

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

public Clients loadClients(int id) {
    Session s = Connection.getSessionFactory().openSession();
    Clients c = (Clients) s.load(Clients.class, id);
    s.flush();
    s.close();//from w ww. j a  v  a2s .  com
    return c;
}

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

public Projects saveProject(Date actualenddate, Date actualstartdate, String clientNote, Clients client,
        Employers employer, Date endDate, String projectDescription, String projectManager, String projectName,
        String projectstatus, String projectType, Date startDate) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    Projects p = new Projects();
    try {//  w  w w .  j  av  a 2s .  co m
        p.setActualEndDate(actualenddate);
        p.setActualStartDate(actualstartdate);
        p.setClientNote(convertToBytes(clientNote));
        p.setClients(client);
        p.setEmployers(employer);
        p.setEndDate(endDate);
        p.setProjectDescription(convertToBytes(projectDescription));
        p.setProjectManager(convertToBytes(projectManager));
        p.setProjectName(convertToBytes(projectName));
        p.setProjectStatus(convertToBytes(projectstatus));
        p.setProjectType(convertToBytes(projectType));
        p.setStartDate(startDate);
        s.save(p);
    } catch (Exception e) {
        t.rollback();
        e.printStackTrace();
    }
    t.commit();
    s.flush();
    s.close();
    return p;
}

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

public Projects loadProjects(int pid) {
    Session s = Connection.getSessionFactory().openSession();
    Projects p = (Projects) s.load(Projects.class, pid);
    s.flush();
    s.close();//from w ww  .  j  a  va 2 s.  co  m
    return p;
}

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

public List<Projects> getAllProjects() {
    Session s = Connection.getSessionFactory().openSession();
    Criteria c = s.createCriteria(Projects.class);
    List<Projects> l = c.list();
    s.flush();
    s.close();//from w w w . j  a va2  s. c o  m
    return l;
}

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

public ProjectTasks saveProjectTasks(Employers emp, Date projectTaskAssign, String projectTaskAssingBy,
        Date projectTaskEnd, String projectTaskNote, Integer priority, Date projectTaskStart,
        String projectTaskStates, String projectTaskType, Projects projects) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    ProjectTasks projectTasks = new ProjectTasks();
    try {//from w  w w . j  a  va2 s  . c  om
        projectTasks.setEmployers(emp);
        projectTasks.setProjectTaskAssing(projectTaskAssign);
        projectTasks.setProjectTaskAssingBy(convertToBytes(projectTaskAssingBy));
        projectTasks.setProjectTaskEnd(projectTaskEnd);
        projectTasks.setProjectTaskNote(projectTaskNote);
        projectTasks.setProjectTaskPriority(priority);
        projectTasks.setProjectTaskStart(projectTaskStart);
        projectTasks.setProjectTaskStates(convertToBytes(projectTaskStates));
        projectTasks.setProjectTaskType(convertToBytes(projectTaskType));
        projectTasks.setProjects(projects);
        s.save(projectTasks);
    } catch (Exception e) {
        t.rollback();
        e.printStackTrace();
    }
    t.commit();
    s.flush();
    s.close();
    return projectTasks;
}

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

public ProjectTasks loadProjectTasks(int taskid) {
    Session s = Connection.getSessionFactory().openSession();
    ProjectTasks projectTasks = (ProjectTasks) s.load(ProjectTasks.class, taskid);
    s.flush();
    s.close();//from  w w w.  j  a v  a 2 s .  com
    return projectTasks;
}

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

public ProjectTaskStates saveProjectTaskStatus(ProjectTasks projectTasks, String topic, String topicActualTime,
        Date topicEnd, String topicEstimateTime, String topicNote, Date topicStartDate, String topicStates) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    ProjectTaskStates projectTaskStates = new ProjectTaskStates();
    try {//w  w w .ja  v  a 2  s.  c  om
        projectTaskStates.setProjectTasks(projectTasks);
        projectTaskStates.setTopic(convertToBytes(topic));
        projectTaskStates.setTopicActualTime(convertToBytes(topicActualTime));
        projectTaskStates.setTopicEnd(topicEnd);
        projectTaskStates.setTopicEstimateTime(convertToBytes(topicEstimateTime));
        projectTaskStates.setTopicNote(topicNote);
        projectTaskStates.setTopicStart(topicStartDate);
        projectTaskStates.setTopicStates(convertToBytes(topicStates));
        s.save(projectTaskStates);
    } catch (Exception e) {
        t.rollback();
        e.printStackTrace();
    }
    t.commit();
    s.flush();
    s.close();
    return projectTaskStates;
}

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

public ProjectTaskStates loadProjectStatus(int pid) {
    Session s = Connection.getSessionFactory().openSession();
    ProjectTaskStates pts = (ProjectTaskStates) s.load(ProjectTaskStates.class, pid);
    s.flush();
    s.close();/*from w ww .j  a va2 s.  c  o m*/
    return pts;
}

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

public TaskDetails saveTaskDetails(ProjectTaskStates prostatus, String actualTime, String calculatedTime,
        Date detailsDate, Date detailsEndDate, String detailsNote, Date detailsStartDate, String detailsTopic) {
    Session s = Connection.getSessionFactory().openSession();
    Transaction t = s.beginTransaction();
    TaskDetails details = new TaskDetails();
    try {/*  ww w.j  a  v a  2s .c  o  m*/
        details.setProjectTaskStates(prostatus);
        details.setTaskDetailsActualTime(convertToBytes(actualTime));
        details.setTaskDetailsCalculateTime(convertToBytes(calculatedTime));
        details.setTaskDetailsDate(detailsDate);
        details.setTaskDetailsEnd(detailsEndDate);
        details.setTaskDetailsNote(convertToBytes(detailsNote));
        details.setTaskDetailsStart(detailsStartDate);
        details.setTaskDetailsTopic(convertToBytes(detailsTopic));
        s.save(details);
    } catch (Exception e) {
        t.rollback();
        e.printStackTrace();
    }
    t.commit();
    s.flush();
    s.close();
    return details;
}