[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - how do you only update a list of checked items in hibernate.

johnybravo2004 do-not-reply at jboss.com
Sun Dec 17 15:10:19 EST 2006


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
					 
        
					 
			  
	
<%}%>


_________________________________________________________________

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994515#3994515

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994515



More information about the jboss-user mailing list