Example usage for org.hibernate Session update

List of usage examples for org.hibernate Session update

Introduction

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

Prototype

void update(Object object);

Source Link

Document

Update the persistent instance with the identifier of the given detached instance.

Usage

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

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

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

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

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

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

}

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

public void updateforce(locationpojo l) {
    Session session = null;
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();/* ww w .ja  va2  s .  c om*/

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

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

public void updateforceV(Answerspojo a) {
    Session session = null;
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();//w w w.ja  va2  s  . c  om

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

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

public void updateforceQ(questionspojo a) {
    Session session = null;
    SessionFactory sessionFactory = new org.hibernate.cfg.Configuration().configure().buildSessionFactory();
    session = sessionFactory.openSession();
    session.beginTransaction();//  www .  j a  v a 2  s .  co  m

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

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

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

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

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

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

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

From source file:com.actop.controller.GetDesignationFromDept.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods.//from w w  w. j  a v a  2s  .co  m
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    try (PrintWriter out = response.getWriter()) {
        String[] rawdeps = request.getParameterValues("depid");
        ArrayList<Integer> depids = new ArrayList<>();
        ArrayList<DepartmentsHasDesignation> dephasdesig = new ArrayList<>();
        for (int i = 0; i < rawdeps.length; i++) {

            depids.add(Integer.parseInt(rawdeps[i]));
        }
        UserManagement um = new UserManagement();
        Departments dep;
        for (int i = 0; i < depids.size(); i++) {
            if (um.loadDesignation(depids.get(i)) != null) {
                dep = um.loadDepartment(depids.get(i));
                dephasdesig.addAll((ArrayList<DepartmentsHasDesignation>) um.getDesignationFromDept(dep));

            }
        }
        Session s = Connection.getSessionFactory().openSession();
        if (dephasdesig != null) {
            dephasdesig.forEach(e -> {
                if (e != null) {
                    s.update(e.getDepartments());
                    s.update(e.getDesignation());
                    s.update(e.getEmployers());
                    out.write("<option ng-repeat=\"sel in selectables\" value=\""
                            + e.getIdDepartmentsHasDesignation() + "\">"
                            + new String(e.getDepartments().getDepartment()) + " "
                            + new String(e.getDesignation().getDesignation()) + " "
                            + new String(e.getEmployers().getCallingName()) + "</option>");
                }
            });
        }
        s.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);
    Transaction t = s.beginTransaction();
    PaymentApproval approval = new PaymentApproval();
    //        System.out.println("AWAAA"+depahasdes+""+payment+"");
    try {/*from w  w w . j  av  a  2 s . c  o m*/
        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 ww  w .  ja  v a 2  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;
}