8 Replies Latest reply on Sep 5, 2010 11:46 AM by Jack Jia

    Target Unreachable, identifier (OBJECT) resolved to null

    Caedmon Judd Newbie

      We cannot get past this error:


      Target Unreachable, identifier '(OBJECT)' resolved to null


      OBJECT is any class we implement with SEAM.  When referenced by the web form, it dies and dumps this error.  Here's an example not including the entity classes.  It's just implementing a simple search routine over a database object named Tcompany.  Currently, it's returning all rows from the Tcompany for testing.


      Class:


      @Stateful
      @Name("TcompanyPersonList")
      @Scope(ScopeType.SESSION)
      public class TcompanyPersonList implements Serializable{
           
          @PersistenceContext
          EntityManager em;
          
          @DataModel
          List<Tcompany> searchResults;
      
          @DataModelSelection
          Tcompany selectedCompany;
          
          String searchString;
      
         
              
          public String getsearchString() {
              return searchString;
          }
          
          public void setsearchString(String searchString) {
      
               this.searchString = searchString;
          }
      
          @Begin(join = true)
          public String doSearch() {
               
               updateResults();
               return "";
               
          }
          
          private void updateResults() {
              
               try {
                    
                    List<Tcompany> results = em.createNativeQuery("from Tcompany c").getResultList();
                    searchResults = results;
                    
               } catch (Exception e) {
                    searchResults = null;
               }        
          }
              
          
          @End
          public void reset() { }
      
          @Destroy
          public void destroy() { }
          
           
      }
      



      Web form:


      <!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"
                      template="layout/template.xhtml">
      
      <ui:define name="body">
      
          <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
          
          <h:form id="tcompanySearch" styleClass="edit">
          
              <rich:simpleTogglePanel label="Contact Search" switchType="ajax">
              
                  <s:decorate template="layout/display.xhtml">
                      <ui:define name="label">Company Name</ui:define>
                      <h:inputText id="cname" value="#{TcompanyPersonList.searchString}"/>
                  </s:decorate>
      
                   <div class="actionButtons">
                       <h:commandButton id="search" value="Search" action="#{TcompanyPersonList.doSearch}"/>
                   </div>
              
              </rich:simpleTogglePanel>        
              
          </h:form>
          
      </ui:define> 
      </ui:composition>
      



      Anything type of object we implement returns the error.