[jboss-user] [JBoss Seam] - Does DataModelSelection work in a Stateless Session Bean?

twocoasttb do-not-reply at jboss.com
Wed Jan 31 02:01:47 EST 2007


I have the following SLSB:

@Stateless
  | @Name("organizationFinder")
  | @Scope(STATELESS)
  | public class OrganizationFinderBean implements OrganizationFinder, Serializable {
  | 
  |   @PersistenceContext
  |   private EntityManager em;
  | 
  |   @In (required=false)
  |   @Out (required=false)
  |   private Organization organization;
  | 
  |   @DataModel(value="organizations")
  |   private List<Organization> organizations;
  | 
  |   @DataModelSelection(value="organizations")
  |   Organization selectedOrganization;
  | 
  |   @Factory
  |   public void getOrganizations() {
  |     log.info("! organization.");
  |      organizations = em.createQuery("select o from Organization o order by o.name")
  |            .getResultList();
  |   }
  | 
  |   @Begin
  |   public String selectOrganization() {
  |     organization = (Organization)em.find(Organization.class, selectedOrganization.getId());
  |     return "editOrganization";
  |   }
  | }

with the following dataTable:

<h:dataTable id="organizations" value="#{organizations}" var="organization">
  | <h:column>
  |   <f:facet name="header">Prefix</f:facet>
  |   #{organization.prefix}
  | </h:column>
  | <h:column>
  |   <f:facet name="header">Name</f:facet>
  |   #{organization.name}
  | </h:column>
  | <h:column>
  |   <f:facet name="header">Legal Name</f:facet>
  |   #{organization.legalName}
  | </h:column>
  | <h:column>
  | 	<f:facet name="header">Action</f:facet>
  | 	<s:link id="editOrganization" value="Edit" 
  | 	        action="#{organizationFinder.selectOrganization}"/>
  | </h:column>
  | </h:dataTable>

Whenever I make a selection in the list, selectOrganization isn't populated, resulting in a NPE in selectOrganization.  I think I'm missing something stupid or obvious.  Any suggestions?


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

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



More information about the jboss-user mailing list