1 Reply Latest reply on Aug 20, 2008 7:24 AM by Max Rydahl Andersen

    Problems with CRUD - Application (Jboss Tools Eclipse)

    Oliver Becherer Newbie

      hi there,

      i have some problems working with a jbosstools - generated Seam Crud Application :

      I generated the xhtmls/entity Beans/ DAOs by reverse engineering from an existing database.

      -> the Crud - pages work fine, but i have problems implementing my own logic :

      i generated a new seam form "loginForm", in which i just wanted to test finding a database entry for an entered value using an Existing EntityQuery CustomerList (also generated from JbossTools).

      heres the layout :

      <!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:a="http://richfaces.org/a4j">


      <h2 align="center"> Login Webshop</h2>
      <h:messages globalOnly="true" styleClass="message"/>

      <h:form id="loginFormForm" styleClass="edit">

      <rich:simpleTogglePanel label="Customer search parameters" switchType="ajax">
      <f:facet name="header">loginForm</f:facet>


      <h:outputLabel value="Username" style="width:500">

      </h:outputLabel>
      <h:inputText id="email" value="#{customerList.customer.email}"/>


      </rich:simpleTogglePanel>




      <h:commandButton id="search" value="UserSearch" action="/loginForm.xhtml"/>



      </h:form>


      <rich:panel>
      <h:outputText value="The search returned no results."
      rendered="#{empty customerList.resultList}"/>

      <h:dataTable id="customerList"
      var="customer"
      value="#{customerList.resultList}"
      rendered="#{not empty customerList.resultList}">

      <h:column>
      <f:facet name="header">KundenKredit</f:facet>
      #{customer.creditLimit}
      </h:column>
      <h:column>
      <f:facet name="header">email</f:facet>
      #{customer.email}
      </h:column>



      </h:dataTable>

      </rich:panel>






      </ui:composition>

      The EntityQueryClass looks as follows :

      package de.medint.webshop.session;

      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityQuery;

      import de.medint.webshop.entity.*;

      import java.util.List;
      import java.util.Arrays;

      @Name("customerList")
      public class CustomerList extends EntityQuery {

      private static final String[] RESTRICTIONS = {
      "lower(customer.email) like concat(lower(#{customerList.customer.email}),'%')" };



      private Customer customer = new Customer();

      @Override
      public String getEjbql() {
      return "select customer from Customer customer";
      }

      @Override
      public Integer getMaxResults() {
      return 25;
      }

      public Customer getCustomer() {
      return customer;
      }

      @Override
      public List getRestrictions() {
      return Arrays.asList(RESTRICTIONS);
      }

      }


      When i call the layout via Browser, i always get the whole content of the table shown, even if i enter an invalid or valid value....

      Watching the ConsoleLog it seems, as if my Querys is executed with a where clause, but directly after that, the same query is executed without where clause. (i think, the resultlist gets overwritten by the queryresult without where...)

      Can somebody please explain me that behaviour?

      thnx alot