0 Replies Latest reply on Jun 17, 2010 4:11 PM by Bruno Ribeiro

    EntityHome update not working as expected!

    Bruno Ribeiro Newbie

      Hi, if I chose a Department object from my suggestionbox all other fields gets filled and the update button appears, but if I click on the update button the Entity doesn't get updated in database and the update buttons dissapears (as the entity is not managed).


      How can I make this thing works?


      My departmentHome.xhtml:


      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:a4j="http://richfaces.org/a4j"
          template="layout/template.xhtml">
         
      <ui:define name="body">
      <h1>Department</h1>
           <a4j:region renderRegionOnly="true">
           <h:form id="departmentHomeId" styleClass="edit">
                <rich:panel>
                     <f:facet name="header">Department edit</f:facet>
                     <s:decorate id="departmentName" template="layout/edit.xhtml">
                      <ui:define name="label">Name:</ui:define>
                      <h:inputText id="departmentNameInput"
                                     size="50"
                                    value="#{departmentHome.instance.name}"
                                 required="true"/>
                  </s:decorate>
                  <rich:suggestionbox for="departmentNameInput"
                         suggestionAction="#{departmentHome.getDepartmentHints}"
                                       var="dep"
                                  minChars="3">
                           <h:column>
                                      <h:outputText value="#{dep.name}"/>
                               </h:column>
                                <a4j:support ajaxSingle="true" event="onselect" reRender="departmentHomeId">
                                  <f:setPropertyActionListener value="#{dep.id}" target="#{departmentHome.id}" />
                              </a4j:support>
                  </rich:suggestionbox>
                  
                  <s:decorate id="departmentAcronym" template="layout/edit.xhtml">
                      <ui:define name="label">Acronym:</ui:define>
                      <h:inputText id="departmentAcronymInput"
                                     size="50"
                                    value="#{departmentHome.instance.acronym}"
                                 required="true"/>
                  </s:decorate>
              <div style="clear:both">
                      <span class="required">*</span> Required fields
              </div>
                </rich:panel>
                
                <div class="actionButtons">
      
                  <h:commandButton id="update"
                                value="Update"
                               action="#{departmentHome.update}"
                             rendered="#{departmentHome.managed}"/>
                </div>
           </h:form>
           </a4j:region>
         
         
      </ui:define>
      </ui:composition>