Ok.  I understand why PAGE scope is appropriate, and recognize why it's the 
right scope for my finder bean.  A conversation isn't required until an item in 
the list is selected for editing.  A SFSB can't have PAGE scope (right?), so I 
assume the DataModel should.  So my finder bean now looks like this:

@SuppressWarnings("serial")
  | @Stateful
  | @Name("organizationFinder")
  | public class OrganizationFinderBean implements OrganizationFinder, 
Serializable {
  | 
  |   @PersistenceContext
  |   private EntityManager em;
  | 
  |   @In (required=false)
  |   @Out (required=false)
  |   private Organization organization;
  | 
  |   @DataModel(scope=ScopeType.PAGE)
  |   private List<Organization> organizations;
  | 
  |   @DataModelSelection
  |   Organization selectedOrganization;
  | 
  |   @Logger
  |   private Log log;
  | 
  |   @SuppressWarnings("unchecked")
  |   @Factory
  |   public void getOrganizations() {
  |      organizations = em.createQuery("select o from Organization o order by 
o.name")
  |            .getResultList();
  |   }
  | 
  |   @Begin
  |   public String newOrganization() {
  |     organization = new Organization();
  |     return "newOrganization";
  |   }
  | 
  |   @Begin
  |   public String selectOrganization() {
  |     organization = em.merge(selectedOrganization);
  |     return "editOrganization";
  |   }
  | 
  |   @Remove @Destroy
  |   public void destroy() {}
  | } 

and my dataTable looks like this:

<h:dataTable id="organizations" value="#{organizations}" var="o">
  | <h:column>
  |   <f:facet name="header">Prefix</f:facet>
  |   #{o.prefix}
  | </h:column>
  | <h:column>
  |   <f:facet name="header">Name</f:facet>
  |   #{o.name}
  | </h:column>
  | <h:column>
  |   <f:facet name="header">Legal Name</f:facet>
  |   #{o.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>

When I select an item in the list I get the following exception:

javax.ejb.EJBException: java.lang.IllegalArgumentException: attempt to create 
merge event with null entity

Based on a post I just saw, I think I'll try injecting the DataModelSelection 
directly into my edit bean.  It seems though, based on prior comments and 
reading the docs, that the above should work.  I assume I'm missing something 
stupid...   Any ideas will be much appreciated.

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009154
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to