0 Replies Latest reply on Dec 17, 2006 3:10 PM by Sue

    how do you only update a list of checked items in hibernate.

    Sue Newbie

      I have list of items in my jsp pages and that are being generated by the following code
      and I want to be able to update multiple records that have a checkbox checked:
      I have a method to update the status and employee name that uses hibernate that takes the taskID
      as a paratmeter to update associated status and comments, but my issue is how to do it with multiple records:


      ____________________________________________________________________________________________-

      private void updateTaskList(Long taskId, String status, String comments) {

      TaskList taskList = (TaskList) HibernateUtil.getSessionFactory()
      .getCurrentSession().load(TaskList.class, personId);

      taskList.setStatus(status);
      taskList.setComment(comments);
      HibernateUtil.getSessionFactory().getCurrentSession().update(taskList);
      HibernateUtil.getSessionFactory().getCurrentSession().save(taskList);

      }

      ______________________________________________



      _______________________________________________






      Employee Name
      Status
      Comment

      <%
      List result = (List) request.getAttribute("result");
      %>
      <%
      for (Iterator itr=searchresult.iterator(); itr.hasNext(); )
      {
      com.dao.hibernate.TaskList taskList = (com.dao.hibernate.TaskList)itr.next();
      %>



      <%=taskList.empName()%>


      <%=taskList.getStatus()%>
      New
      Fixed
      Closed





      <%}%>


      _________________________________________________________________