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

stu2 do-not-reply at jboss.com
Fri Mar 30 14:54:09 EDT 2007


"smithbstl" wrote : 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.
  | 
  | @Stateful
  |   | @Name("addressListing")
  |   | @Scope(ScopeType.SESSION)
  |   | public class AddressListing implements mypackage.AddressListingLocal {
  |   |     
  |   |     @DataModel
  |   |     private List<StructureAddress> addresses;
  |   |    
  |   |     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;
  |   |     }
  |   | }
  |   | 
  | 
  | Here is the page
  | 
  | 
  |   |         <tr:table  
  |   |             id="addresses"
  |   |             var="addressRow" 
  |   |             value="#{addresses}" 
  |   | ...            
  |   |         </tr:table>

Looking at your page, you're binding the outjected #{addresses} to the table.  And in the SFSB that field is in fact annoted properly.  But I don't see in your bean where that value is initialized.  How is findAddresses() called?  And if it is, when is it?  If it's called from the page rendering I wonder if this means the addresses list is populated AFTER Seam has outjected it.  I think you may need a @Factory or @Create here.

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

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



More information about the jboss-user mailing list