2 Replies Latest reply on Sep 8, 2009 11:47 PM by Jenny Jasti

    Save data from a datatable

    Jenny Jasti Newbie

      Hi All,

      I need some help with storing the data from the datatable back to the database all at once. I have a UI where I display the data using a dataTable in textboxes, when the user edits some of them I should capture the data and save them all at once.

      Can some one suggest me how this is possible using seam.


        • 1. Re: Save data from a datatable
          Phil Haigh Novice

          hi jenny,

          Presuming your datatable just interates through a number of Entity instances, you should just be able to have each row containing the relevant h:input tags, and then just have your save button call a function that causes a flush. Everything should then be saved.

          • 2. Re: Save data from a datatable
            Jenny Jasti Newbie

            Thankyou for your reply, I am using the dataTable with inputText Boxes and when the user updates the textboxes I am trying to save the data back to the database:

            I am using a factory method to display the workflowData when the user comes to the page

              <h:form id="workflowForm" styleClass="edit">
             <rich:dataTable var="workflowUsers" value="#{workflowData}" rendered="#{workflowData.rowCount>0}" >
                     <f:facet name="header">
                        <h:outputText value="Review Order"/>
                    <s:decorate id="userIdField" template="layout/edit.xhtml">
                         <h:inputText id="reviewOrder"
                     <f:facet name="header">
                        <h:outputText value="Role"/>
                        <h:selectOneMenu value="#{workflow.getRoles()}">
                              <s:convertEntity />
                                <s:selectItems value="#{workflow.getRoles()}"
                                    label="#{userRole.roleDescription}" noSelectionLabel="list"/>
                    <div class="actionButtons">
                         <h:commandButton id="workflow" value="Save Workflow"

            When I change the value of ReviewOrder filed the control is still going to Factroy method even if the workflowdata is not null.

            Here is the code of my backing bean

                public void getWorkflowData()
                     log.info("33333333333333 ");
                     workflowData = em.createQuery("from GwpsProofWorkflow w where w.gwpsProof=:gwpsProof")
                    .setParameter("gwpsProof", proof )
                     log.info("3333333333333 "+workflowData.size());
                     for(GwpsProofWorkflow workflow: workflowData) {

            Before going to saveWorkflow method the control is going to getWorkflowData(), can someone tell me why?