2 Replies Latest reply on Sep 24, 2007 7:22 PM by Vincent LAUGIER

    EntityConverter with patch for seam 1.2.0

    Vincent LAUGIER Newbie

      Hello,

      we have been strugling all day trying to make the patch for EntityConverter work

      for seam_EAP 4.2 with integrated seam 1.2.0

      we have followed
      http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamEntityConverter

      but it doesn't work and we are short of ideas now

      we get the following error in french
      sourceId=createService:radioService[severity=(ERROR 2), summary=(la valeur nest pas valide), detail=(la valeur nest pas valide)]

      which I translate as

      sourceId=createService:radioService[severity=(ERROR 2), summary=(value is not valid), detail=(value is not valid)]

      I put as attachment our code for the web page and the manager (bean + interface)

      I know the support is not meant for debugging our code, but in that case I dare to ask since this is a basic functionnality of seam that we expect to work


      the web page code

      
      <!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"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:ec="http://jboss.com/products/seam/entityconverter/taglib"
       template="layout/template.xhtml">
      
      <ui:define name="body">
      
       <h:messages globalOnly="true" styleClass="message"/>
      
      
      
       <h:form id="createService" styleClass="edit">
      
       <rich:panel>
       <f:facet name="header">Créer un compte</f:facet>
       <s:validateAll>
       <div class="input">
       <s:decorate template="layout/edit.xhtml">
       <ui:define name="label">nom du service :</ui:define>
       <h:inputText id="login" size="50" value="#{service.name}" required="true" />
       </s:decorate>
       </div>
      
       <div class="input">
       
       <h:selectOneRadio id="radioService" value="#{selectedService}">
       <s:selectItems value="#{createService.services}" var="row"
       label="#{row.name}" /><br/>
       <ec:convertEntity />
       </h:selectOneRadio>
      
       </div>
      
       </s:validateAll>
      
      
       </rich:panel>
      
       <div class="actionButtons">
      
       <h:commandButton value="Créer le service"
       action="#{createService.createService()}"/>
      
      
       </div>
      
       </h:form>
      
      </ui:define>
      
      </ui:composition>
      
      



      the manager bean
      package fr.helmet.portal.manager;
      
      import fr.helmet.portal.entity.Service;
      import java.util.List;
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import javax.persistence.PersistenceContextType;
      import org.jboss.seam.annotations.Create;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Destroy;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Out;
      import org.jboss.seam.log.Log;
      import org.jboss.seam.core.FacesMessages;
      
      @Stateful
      @Name("createService")
      public class CreateServiceBean implements CreateService {
      
       @Logger private Log log;
      
       @In FacesMessages facesMessages;
      
       @In (required=false)
       @Out (required=false)
       private Service service;
      
       @PersistenceContext(type=PersistenceContextType.EXTENDED)
       private EntityManager entityManager;
      
      
       @In (required=false)
       private Service selectedService;
      
       public Service getSelectedService() {
       return selectedService;
       }
      
       public void setSelectedService(Service selectedService) {
       this.selectedService = selectedService;
       }
      
      
      
       private List<Service> services;
       
       public void createService()
       {
       //implement your business logic here
       //log.info("createService.createService() action called with: #{createService.name}");
       //facesMessages.add("createService #{createService.name}");
      
      
       System.out.println("enregistrement du produit");
      
       if (this.selectedService != null) this.service.setParentService(selectedService);
      
       entityManager.persist(service);
       this.services.add(service);
       this.service = null;
       }
      
       //add additional action methods
       @Create
       public void find() {
      
       this.services = entityManager.createQuery("select c from Service c").getResultList();
       }
      
      
       public Service getService() {
       return service;
       }
      
       public void setService(Service service) {
       this.service = service;
       }
      
       public List<Service> getServices() {
       return services;
       }
      
       public void setServices(List<Service> services) {
       this.services = services;
       }
      
      
      
       @Destroy @Remove
       public void destroy() {}
      
      }
      



      hope someone had this problem already

      patching old version is such a pain, arghhh !!