Converter is not needed for id, since it's a Long. Now I can pass the id from 
the page to Home and use getEntityManager().find() to load the parent business 
entity and wire it up with the child. But we are kind of falling back to the 
old style, I was hoping that there be a way to inject the parent or its home 
into the child's Home. It looks to me that Seam's bijection is not general or 
flexible enough to cover this specific situation.

And now, I am getting into a new problem: the parent's Home object does not get 
cleaned up when creating the child, so the edit page for creating the child 
still shows values from the parent and thus the wrong set of buttons. Here is 
how my page looks like:

<ui:define name="body">
  |     
  |     <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
  | 
  |     <h:form id="business" styleClass="edit">
  |     
  |         <rich:panel>
  |             <f:facet name="header">Edit Business</f:facet>
  | 
  |             <s:decorate id="nameDecoration" template="layout/edit.xhtml">
  |                 <ui:define name="label">name</ui:define>
  |                 <h:inputTextarea id="name"
  |                                cols="80"
  |                                rows="3"
  |                               value="#{businessHome.instance.name}"/>
  |             </s:decorate>
  | 
  |             <s:decorate id="descriptionDecoration" 
template="layout/edit.xhtml">
  |                 <ui:define name="label">description</ui:define>
  |                 <h:inputTextarea id="description"
  |                                cols="80"
  |                                rows="3"
  |                               value="#{businessHome.instance.description}"/>
  |             </s:decorate>
  |         
  |             <div style="clear:both">
  |                 <span class="required">*</span> 
  |                 required fields
  |             </div>
  |         </rich:panel>
  |                 
  |         <div class="actionButtons">
  | 
  |             <h:commandButton id="save" 
  |                           value="Save" 
  |                          action="#{businessHome.persist}"
  |                        disabled="#{!businessHome.wired}"
  |                        rendered="#{!businessHome.managed}"/>  
  |                                               
  |             <h:commandButton id="update" 
  |                           value="Update" 
  |                          action="#{businessHome.update}"
  |                        rendered="#{businessHome.managed}"/>
  |                                               
  |             <h:commandButton id="delete" 
  |                           value="Delete" 
  |                          action="#{businessHome.remove}"
  |                        rendered="#{businessHome.managed}"/>
  |                     
  |             <s:button id="done" 
  |                    value="Done"
  |              propagation="end"
  |                     view="/BusinessSearch.xhtml"
  |                 rendered="#{businessHome.managed}"/>
  |                 
  |             <s:button id="cancel" 
  |                    value="Cancel"
  |              propagation="end"
  |                     view="/BusinessSearch.xhtml"
  |                 rendered="#{!businessHome.managed}"/>
  | 
  |         </div>
  |         
  |         <s:div styleClass="actionButtons">
  |             <s:button view="/BusinessEdit.xhtml"
  |                         id="createChild" 
  |                      value="Create Child Business">
  |                 <f:param name="parentBusinessId" 
value="#{businessHome.instance.id}"/>
  |             </s:button>
  |         </s:div>
  |         
  |     </h:form>
  | 
  | </ui:define>

<page no-conversation-view-id="/BusinessSearch.xhtml">
  |    
  |    <begin-conversation nested="true"/>
  |    
  |    <action execute="#{businessHome.wire}"/>
  |    
  |    <param name="businessId" value="#{businessHome.businessId}"/>
  |    <param name="parentBusinessId" value="#{businessHome.parentBusinessId}"/>
  | 
  |    <navigation from-action="#{businessHome.persist}">
  |        <end-conversation/>
  |        <redirect view-id="/BusinessSearch.xhtml"/>
  |    </navigation>
  |    
  |    <navigation from-action="#{businessHome.update}">
  |        <end-conversation/>
  |        <redirect view-id="/BusinessSearch.xhtml"/>
  |    </navigation>
  |    
  |    <navigation from-action="#{businessHome.remove}">
  |        <end-conversation/>
  |        <redirect view-id="/BusinessSearch.xhtml"/>
  |    </navigation>
  |    
  | </page>

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

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

Reply via email to