Example usage for org.hibernate Session load

List of usage examples for org.hibernate Session load

Introduction

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

Prototype

void load(Object object, Serializable id);

Source Link

Document

Read the persistent state associated with the given identifier into the given transient instance.

Usage

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 {//from  www  .  j av  a  2  s .  com
        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 getAllowanceApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    AllowanceApproval allowanceApproval = (AllowanceApproval) s.load(AllowanceApproval.class, id);
    s.flush();// w w w. ja  v  a2s.co  m
    s.close();
    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  .ja va  2  s  .  c o m
        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 getOtherApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    OtherApprovals otherApproval = (OtherApprovals) s.load(OtherApprovals.class, id);
    s.flush();//from  w w w  . j a v  a2 s  . co  m
    s.close();
    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 {/*www  .  j a  v a2s  . 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.ApprovalManagement.java

public LeaveApproval getLeaveApproval(int id) {
    Session s = Connection.getSessionFactory().openSession();
    LeaveApproval la = (LeaveApproval) s.load(LeaveApproval.class, id);
    s.close();/*www.  java 2 s  . co m*/
    return la;
}

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

public InterfacesHasUserLogin updateInterfacesHasUserLogin(Interfaces interfacedb, Integer delete, Integer save,
        Integer search, Integer permissionType, Integer update, UserLogin uLogin, int id) {
    if (loadPermission(uLogin, interfacedb)) {
        Session s = Connection.getSessionFactory().openSession();
        Transaction t = s.beginTransaction();
        InterfacesHasUserLogin hasUserLogin = (InterfacesHasUserLogin) s.load(InterfacesHasUserLogin.class, id);
        try {//from   w  w  w.  j av a  2  s.c o m
            hasUserLogin.setInterfaces(interfacedb);
            hasUserLogin.setPermissionDelete(delete);
            hasUserLogin.setPermissionSave(save);
            hasUserLogin.setPermissionSearch(search);
            hasUserLogin.setPermissionType(permissionType);
            hasUserLogin.setPermissionUpdate(update);
            hasUserLogin.setUserLogin(uLogin);
            s.update(hasUserLogin);
        } catch (Exception e) {
            t.rollback();
            e.printStackTrace();
        }
        t.commit();
        s.flush();
        s.close();
        return hasUserLogin;
    }
    return null;
}

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();/*  w  w  w.  jav a 2  s .c om*/
    s.close();
    return c;
}

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();//from  w  w w  . j a  v a 2  s  .c om
    s.close();
    return p;
}

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();/* ww  w.j  ava  2 s. co m*/
    s.close();
    return projectTasks;
}