[jboss-user] [JBoss Seam] - @DataModel problems

smithbstl do-not-reply at jboss.com
Fri Mar 30 13:11:07 EDT 2007


I keep getting this returned via the debug page under my datamodel component.  Why is the row unavailable?  The wrapped data is some of the data returned via my query but the data model is not being displayed on the page.  No exception is thrown.

 class   	 class org.jboss.seam.jsf.ListDataModel
  | dataModelListeners 	[]
  | rowAvailable 	false
  | rowCount 	1
  | rowData 	java.lang.IllegalArgumentException[row is unavailable]
  | rowIndex 	-1
  | wrappedData 	[com.stlouiscity.csb.ejb.domain.Address[structureAddressPK=com.stlouiscity.csb.ejb.domain.AddressPK[sadrNlc=720, sadrHseNoSfx= , sadrHseNoLegl=6047]]]
  | toString() 	org.jboss.seam.jsf.ListDataModel at 1eca460

Here is my SFSB
@Stateful
  | @Name("addressListing")
  | @Scope(ScopeType.SESSION)
  | public class AddressListing implements mypackage.AddressListingLocal {
  |     
  |     //@EJB private AddressLocatorLocal locator;
  |     @PersistenceContext(unitName="CSB_Oracle", type=EXTENDED)
  |     private EntityManager em; 
  |         
  |     @In(create=true)
  |     FacesMessages facesMessages;
  | 
  |     @In
  |     private Address address;
  |     
  |     private Integer addressLookupPK;
  |     
  |     @DataModel
  |     private List<StructureAddress> addresses;
  | 
  |     @Out(required=false)
  |     private List<String> streetDirections;
  | 
  |     public AddressListing() {
  |     }
  |    
  |     public String findAddresses() {
  | 
  |         if (address.getStreetName() != null) {
  |             //Find StructureAddress
  |             Query q = em.createQuery("Select a From StructureAddress a Where" +
  |                         " (a.structureAddressPK.houseNumber = :houseNumber OR :houseNumber IS NULL) AND" +
  |                         " (a.structureAddressPK.houseSuffix = :suffix OR :suffix IS NULL) AND" +
  |                         " (a.nlc.streetDirection = :streetDirection OR :streetDirection IS NULL) AND" +
  |                         " (lower(a.nlc.streetName) LIKE :street OR :street IS NULL)");
  |             q.setParameter("houseNumber",address.getHouseNumber());
  |             q.setParameter("suffix",address.getHouseSuffix());
  |             q.setParameter("streetDirection",address.getStreetDirection());
  |             q.setParameter("street",address.getStreetName().toLowerCase() + "%");
  |             addresses = q.getResultList();       
  |         }
  |             
  |         return null;
  |     }
  |      
  |     @Factory("streetDirections")
  |     public void fillStreetDirections() {
  |         Query query = em.createQuery("SELECT DISTINCT n.streetDirection FROM Nlc n WHERE n.streetDirection IS NOT NULL");
  |         streetDirections = query.getResultList();
  |     }
  |     
  |     @Remove @Destroy
  |     public void destroy() {
  |         
  |     }
  | }
  | 

Here is the page

<tr:outputText value="No Addresses Found" rendered="#{empty addresses and addresses!=null}"/>        
  |         <tr:table  
  |             id="addresses"
  |             var="addressRow" 
  |             value="#{addresses}" 
  |             rowBandingInterval="1"
  |             rendered="#{addresses!=null}"
  |             rowSelection="single"
  |             partialTriggers="addressForm:search">    
  |             <tr:column>
  |                 <f:facet name="header">
  |                     <tr:outputText value="#{msgs['AddressList.addressNumber']}"/>
  |                 </f:facet>
  |                 <s:link id="viewRequests" value="Requests" action="#{addressListing.findRequests}"/>
  |             </tr:column>            
  |             <tr:column>
  |                 <f:facet name="header">
  |                     <tr:outputText value="#{msgs['AddressList.addressNumber']}"/>
  |                 </f:facet>
  |                 <tr:outputText value="#{addressRow.structureAddressPK.houseNumber}"/>
  |             </tr:column> 
  |             <tr:column>
  |                 <f:facet name="header">
  |                     <tr:outputText value="#{msgs['AddressList.addressSuffix']}"/>
  |                 </f:facet>
  |                 <tr:outputText value="#{addressRow.structureAddressPK.houseSuffix}"/>
  |             </tr:column>             
  |             
  |             
  |             <tr:column>
  |                 <f:facet name="header">
  |                     <tr:outputText value="#{msgs['AddressList.streetDirection']}"/>
  |                 </f:facet>
  |                 <tr:outputText value="#{addressRow.nlc.streetDirection}"/>
  |             </tr:column>
  |             <tr:column>
  |                 <f:facet name="header">
  |                     <tr:outputText value="#{msgs['AddressList.street']}"/>
  |                 </f:facet>
  |                 <tr:outputText value="#{addressRow.nlc.streetName}"/>
  |             </tr:column>
  |             <tr:column>
  |                 <f:facet name="header">
  |                     <tr:outputText value="#{msgs['AddressList.streetType']}"/>
  |                 </f:facet>
  |                 <tr:outputText value="#{addressRow.nlc.streetType}"/>
  |             </tr:column>            
  |         </tr:table>

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033288#4033288

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033288



More information about the jboss-user mailing list