11 Replies Latest reply on Aug 5, 2009 11:56 PM by Ingo Jobling

    Component Injection & h:selectOne with a4jsupport

    john mcdonald Newbie

      Let me preface this post by saying that I'm very new to seam but I'm i've been a developer for 15 years. I just started working with seam two weeks ago and have spent, literally, every waking moment since trying get this project up and running. So, if you see something in my code that makes you think. WTF is this guy doing, please point it out.


      OK, so let me lay it out for you.
      1) I have  an existing SoftSlate commerce implementation which I'm enhancing with a detached seam framework that allows me to select drop ship vendors for line items on existing orders. I've used seam-gen to lay out all of the base entities and now I'm working to tack on a few additional components that will allow this DropShipOrders.xhtml page to operate.


      2) I'm using a rich:dataTable to iterate over the outstanding orders which are pulled from component DropShipOrdersAction.


      3) I also display the line items for each order by pulling them from the scoped Orders entity.


      4) For each line item I’m pull the vendors for that line item using the DropShipVendorAction component.


      This page loads correctly with the correct data for each Orderitem. What I want to accomplish is when the user selects a new Vendor I want to be able to update the Product entity with the new Vendor for this product. The existing



        • 1. Re: Component Injection & h:selectOne with a4jsupport
          john mcdonald Newbie

          Sorry, last post was posted before I was ready.


          Let me preface this post by saying that I'm very new to seam but I'm i've been a developer for 15 years. I just started working with seam two weeks ago and have spent, literally, every waking moment since trying get this project up and running. So, if you see something in my code that makes you think. WTF is this guy doing, please point it out.


          OK, so let me lay it out for you.
          1) I have  an existing SoftSlate commerce implementation which I'm enhancing with a detached seam framework that allows me to select drop ship vendors for line items on existing orders. I've used seam-gen to lay out all of the base entities and now I'm working to tack on a few additional components that will allow this DropShipOrders.xhtml page to operate.


          2) I'm using a rich:dataTable to iterate over the outstanding orders which are pulled from component DropShipOrdersAction.


          3) I also display the line items for each order by pulling them from the scoped Orders entity.


          4) For each line item I’m pull the vendors for that line item using the DropShipVendorAction component.


          This page loads correctly with the correct data for each Orderitem. What I want to accomplish is when the user selects a new Vendor I want to be able to update the Product entity with the new Vendor for this product. The existing s:convertEntity is left over from my attempt to directly update the Product entity by using the following which resulted in Hibernate errors being thrown.




          <h:selectOneMenu value="#{_orderitem.product.vendor}">
               <s:selectItems value="#{DropShipVendor.vendorList}" noSelectionLabel="Select..." var="vendor" label="#{vendor.company}" />
               <s:convertEntity/>
               <a:support event="onchange" reRender="messages" focus="messages" process="_orderitem" ajaxSingle="true"/>
          </h:selectOneMenu>  
          





          So, what I REALLY need to know is how the heck do I get the orderitem injected into my DropShipVendorAction componenent so that I can update the product with the newly selected vendor.


          I have been working on this one issue for nearly 30 hours and I’m really hoping someone can point out the stupid mistakes that I’m making so I can get past this roadblock.


          Thank you for your time.



          DropShipOrdersAction


          @Stateful
          @Name("DropShipOrders")
          public class DropShipOrdersAction implements DropShipOrders {
          
              @Logger private Log log;
              
              @In FacesMessages facesMessages;
             
              @PersistenceContext
              private EntityManager em;
          
              @DataModel 
              List<Orders> dropShipOrdersList;
              
              @DataModelSelection
              Orders order;
              
              @Factory(scope=ScopeType.CONVERSATION)
              public List<Orders> getDropShipOrdersList() {
                   dropShipOrdersList = em.createQuery("select o from Orders o where o.orderId In(13247,13115)").getResultList();
                   return dropShipOrdersList;
              }
               
               public ArrayList<SelectItem> getVendorList(){
                    log.info("DropShipOrders.getVendorList");
                    ArrayList<SelectItem>vendorList;
                    vendorList = new ArrayList<SelectItem>();
                    vendorList.add(new SelectItem(null,"Select Vendor..."));
                    vendorList.add(new SelectItem("1", "Bold Hardware"));
                    vendorList.add(new SelectItem("2", "Charles McMurray"));
                   return vendorList;
               }
               
               public void transmitOrder(){
                    if( order != null) {
                         log.info("DropShipOrders.transmitOrder Order "+order.getOrderId()+" IS NOT Null");
                         order.setStatus("Processing");
                         em.persist(order);
                         //dropShipOrdersList.remove(order);
                    }
                    log.info("DropShipOrders.transmitOrder Called");
               }
               
               public void updateVendor(){
                    //implement your business logic here
                    log.info("DropShipOrders.UpdateVendor action called with: "+vendorid);
                    log.info("DropShipOrders.UpdateVendor Order Null: "+(order==null));
                    //log.info("DropShipOrders.UpdateVendor Orderitem Null: "+(orderitem==null));
                    facesMessages.add("Vendor #{DropShipOrders.vendorid}");
               }
               
                @Destroy @Remove                                                                      
                public void destroy() {}
          
               
          }
          



          DropShipOrders.xhtml


          <rich:panel>
                         <f:facet name="header">Orders search results</f:facet>
                         <div class="results" id="ordersList">
                         
                         <rich:dataTable
                              id="ordersList" var="_orders" value="#{DropShipOrders.dropShipOrdersList}"
                              rendered="#{not empty ordersList.resultList}">
                          
                              <!-- <f:facet name="header"> -->
                                   <rich:columnGroup style="border:1px solid #FFFFBB;background: #A99999;color: white;">
                                      <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                      <f:facet name="header">
                                             <h:outputText value="spacer" />
                                         </f:facet>
                                         Order ID</rich:column>
                                      <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                      <f:facet name="header">
                                             <h:outputText value="spacer" />
                                         </f:facet>
                                         Customer</rich:column>
                                      <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                      <f:facet name="header">
                                             <h:outputText value="spacer" />
                                         </f:facet>
                                         Company</rich:column>
                                      <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                      <f:facet name="header">
                                             <h:outputText value="spacer" />
                                         </f:facet>
                                         Status</rich:column>
                                         <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                      <f:facet name="header">
                                             <h:outputText value="spacer" />
                                         </f:facet>
                                         Action</rich:column>
                                  </rich:columnGroup>
                                  
                              <!-- </f:facet> -->
                              <rich:columnGroup style="vertical-align: top;height:25px">
                                   <rich:column  colspan="1">
                                        <h:outputText value="#{_orders.orderId}" />
                                   </rich:column>
                                   <rich:column   colspan="1">
                                        <h:outputText value="#{_orders.customer.firstName} #{_orders.customer.lastName}" />
                                   </rich:column>
                                   <rich:column  colspan="1">
                                        <h:outputText value="#{_orders.customer.organization}" />
                                   </rich:column>
                                   <rich:column  colspan="1">
                                        <h:outputText value="#{_orders.status}" />
                                   </rich:column>
                                   <rich:column colspan="1">
                                         <h:form>
                                             <h:commandLink value="test" action="#{DropShipOrders.transmitOrder}"/>
                                        </h:form>
                                    </rich:column>
                              </rich:columnGroup>     
                              
                              <rich:subTable var="_orderitem" value="#{_orders.orderitems}">
                                  <rich:column>
                                       <f:facet name="header">Vendor</f:facet>
                                              <h:form  styleClass="edit">        
                                                 <!--  <h:inputHidden id="orderItem" value="#{_orderitem}"/> -->
                                                 <h:outputText value="#{_orderitem.product.vendor.company}"></h:outputText>
                                                   <h:selectOneMenu value="#{DropShipVendor.vendor}">
                                                          <s:selectItems value="#{DropShipVendor.vendorList}" noSelectionLabel="Select..." var="vendor" label="#{vendor.company}" />
                                                          <s:convertEntity/>
                                                          <a:support event="onchange" reRender="messages" focus="messages" process="_orderitem" ajaxSingle="true"/>
                                                       </h:selectOneMenu>                    
                                                 </h:form>
                                            <f:facet style="height : 25px;" name="ass">test<rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                  </rich:column> 
                                  <rich:column>
                                       <f:facet name="header">Qty</f:facet>
                                      <h:outputText value="#{_orderitem.quantity}"></h:outputText>
                                      <f:facet style="height : 25px;" name="ass"><rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                  </rich:column>
                                  <rich:column>
                                       <f:facet name="header">Product</f:facet>
                                      <h:outputText value="#{_orderitem.product.name}"></h:outputText>
                                      <f:facet style="height : 25px;" name="ass"><rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                  </rich:column>
                                  <rich:column >
                                       <f:facet name="header">Model</f:facet>
                                      <h:outputText value="#{_orderitem.code}"></h:outputText>
                                      <f:facet style="height : 25px;" name="ass">this si a test<rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                  </rich:column>
                                  <rich:column >
                                       <f:facet name="header">Action</f:facet>
                                      <h:outputText value="#{_orderitem.code}"></h:outputText>
                                      <f:facet style="height : 25px;" name="ass">this si a test<rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                  </rich:column>
                              </rich:subTable>
                              
                              <rich:columnGroup style="height:50px;border:none;">
                                   <rich:column colspan="5"></rich:column>
                              </rich:columnGroup>
                          </rich:dataTable>
                         </div>
                    </rich:panel>




          DropShipVendorAction


          @Stateful
          @Name("DropShipVendor")
          public class DropShipVendorAction implements DropShipVendor {
          
              @Logger private Log log;
              
              @In FacesMessages facesMessages;
             
              @In private EntityManager entityManager;
              
              @In (required=false)
              Orderitem orderitem;
          
              private Vendor vendor;
              
              public List<Vendor> getVendorList() {
                   List<Vendor> vendorList =  entityManager.createQuery("select v from Vendor v where v.company In('Bold Hardware Co.','Charles McMurray')").getResultList();
                   return vendorList;
              }
              
              public Vendor getVendor() {
                   return vendor;
              }
              
              public void setVendor(Vendor vendor) {
                   log.info("DropShipVendor.setVendorID action called with: "+vendor.getCompany());
                    log.info("DropShipOrders.setVendorID Orderitem Null: "+(orderitem==null));
                    //log.info("DropShipOrders.setVendorID Order Null: "+(order==null));
                    //log.info("DropShipOrders.setVendorID EM Null: "+(em==null));
                    facesMessages.add("Vendor #{vendor.company}");
                   this.vendor = vendor;
              }
               
                @Destroy @Remove                                                                      
                public void destroy() {}
          
          }
          







          • 2. Re: Component Injection & h:selectOne with a4jsupport
            Ingo Jobling Master

            Hello John,


            What you posted looks like you are on the right track to have the vendor for the product updated.  You mention Hibernate errors being thrown, please post the stack trace.


            <h:selectOneMenu value="#{_orderitem.product.vendor}">
                 <s:selectItems value="#{DropShipVendor.vendorList}" noSelectionLabel="Select..." var="vendor" label="#{vendor.company}" />
                 <s:convertEntity/>
                 <a:support event="onchange" reRender="messages" focus="messages" process="_orderitem" ajaxSingle="true"/>
            </h:selectOneMenu>



            Regards, Ingo


            • 3. Re: Component Injection & h:selectOne with a4jsupport
              Arbi Sookazian Master

              There's a lot of code posted here which is good and bad.  The bottom line is the Orderitem instance must exist in one of the Seam contexts (e.g. conversation or session scope) at the time of injection, otherwise it will not be injected.


              this:


              <h:selectOneMenu value="#{_orderitem.product.vendor}">



              is either not recommended and/or not allowed.  The value needs a setter and getter method and multiple object path navigation is not applicable in this context.


              typically this is correct:


              <h:selectOneMenu value="#{myComponent.foo}">



              where foo corresponds to getFoo() and setFoo(Object obj) for the entity in the drop down.


              Describe the entity relationships.  I'm assuming it's every vendor has one or many products and every product has one or many orderitems.


              As long as the user selects the correct orderitem in the form, the action listener on submission can get the related product and/or vendor for that selected orderitem.  Try using the @DataModel (outject ListDataModel) and @DataModelSelection (inject selected entity) combo.  It seems to me that no additional injection is required.

              • 4. Re: Component Injection & h:selectOne with a4jsupport
                john mcdonald Newbie

                Hi Ingo,


                Thank you, VERY MUCH, for your assistance. I greatly appreciate your help. here's the stack you requested.


                Also, I did some research on this error and several posts suggested that I set the cascade type on the getVendor method of product to CascadeType.ALL. That caused additional errors related to concurrent collection modification. When I googled those errors, they were related to the CascadeType.ALL implementation. I really like Seam but it's learning curve has given me a really sore forehead(with all beating against the wall)



                Exception during request processing:
                Caused by java.lang.IllegalStateException with message: "Could not commit transaction"
                
                org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:623)
                org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:603)
                org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:341)
                org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:241)
                org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
                com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
                com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
                com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
                org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                java.lang.Thread.run(Unknown Source)
                
                Caused by javax.transaction.RollbackException with message: "[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state"
                
                com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1418)
                com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
                com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
                org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:146)
                org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
                org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:613)
                org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:603)
                org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:341)
                org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:241)
                org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
                com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
                com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
                com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
                org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                java.lang.Thread.run(Unknown Source)
                
                Caused by java.lang.IllegalStateException with message: "org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xeosuite.xeoadmin.entity.Product.vendor -> com.xeosuite.xeoadmin.entity.Vendor"
                
                org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:634)
                org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:532)
                com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
                com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
                com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
                com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
                com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1406)
                com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
                com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
                org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:146)
                org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
                org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:613)
                org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:603)
                org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:341)
                org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:241)
                org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
                com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
                com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
                com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
                org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                java.lang.Thread.run(Unknown Source)
                
                Caused by org.hibernate.TransientObjectException with message: "object references an unsaved transient instance - save the transient instance before flushing: com.xeosuite.xeoadmin.entity.Product.vendor -> com.xeosuite.xeoadmin.entity.Vendor"
                
                org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:353)
                org.hibernate.engine.Cascade.cascade(Cascade.java:139)
                org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
                org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
                org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
                org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
                org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
                org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
                org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:523)
                com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
                com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
                com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
                com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
                com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1406)
                com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
                com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
                org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:146)
                org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
                org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:613)
                org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:603)
                org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:341)
                org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:241)
                org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
                com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
                com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
                com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
                org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                java.lang.Thread.run(Unknown Source)
                
                



                • 5. Re: Component Injection & h:selectOne with a4jsupport
                  john mcdonald Newbie

                  Hi Arbi,


                  Thank you for your help.


                  1) Orders contains multiple Orderitems per Order
                  2) Orderitem has one product per Orderitem
                  3) There's a Many to Many relationship between Product and Vendor, so Product may have multiple Vendor's but vendor may also have multiple products. I have a join table called ProductVendor and the ProductVendor list is available through each Product and through each vendor. However to make things more simple I've created the action component to simply supply a predefinded list of Vendors which I know happen to be assigned to the products on the orders that I'm viewing(this is a prototype application after all) ;-). In addition I have a Vendor field in product(which will be moved to OrderItem, which is intended to hold the default Vendor for this product and will be the vendor who actually ships the order. This is the Vendor that I want to be able to change based on the list of available vendors.


                  Please let me know if you have any other questions.


                  Thank you for your help!


                  -john:m


                  • 6. Re: Component Injection & h:selectOne with a4jsupport
                    Ingo Jobling Master

                    The key thing in the stacktrace is


                    Caused by java.lang.IllegalStateException with message: "org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xeosuite.xeoadmin.entity.Product.vendor -> com.xeosuite.xeoadmin.entity.Vendor"
                    



                    Possibly the id in the instance of Vendor is not valid (null?).

                    I noticed in the code you posted that you have two versions of getVendorList(), one returns ArrayList<SelectItem> and the other returns List<Vendor>.  You are using the one which returns List<Vendor> in the <s:selectItems>, right?


                    Something you could try is to replace <s:convertEntity> with a standard JSF converter (very simple, just implement getAsObject and getAsString, and use the @Converter annotation so you don't have to register it in faces-config.xml.  This will be simpler to debug than <s:convertEntity> as you can easily set breakpoints on these two methods.

                    • 7. Re: Component Injection & h:selectOne with a4jsupport
                      john mcdonald Newbie

                      Hi Ingo,

                      Yes, I have been trying to get this work any way that I can and the DropShipOrdersAction.getVendorList was the first attempt. DropShipVendorAction.getVendorList is the one currently being used in the xhtml to populate the selectOne menu. I agree with you, based on the stack verbiage it sounds like the Vendor object is transient and perhaps has an invalid ID but these entities are pulled using the entityManager in DropShipVendorAction.getVendorList; they should be valid. I'll go check to see if this holds water.....


                      checking....

                      checking....

                      checking....


                      Holy crap!! You're right. When I look at the resulting HTML the select looks like this:




                      <!--  <h:inputHidden id="orderItem" value="com.xeosuite.xeoadmin.entity.Orderitem@1757c6f"/> -->Charles McMurray<select name="ordersList:0:j_id93:0:j_id96:j_id99" size="1" onchange="A4J.AJAX.Submit('_viewRoot','ordersList:0:j_id93:0:j_id96',event,{'control':this,'parameters':{'ordersList:0:j_id93:0:j_id96:j_id101':'ordersList:0:j_id93:0:j_id96:j_id101'} ,'actionUrl':'/xeoadmin/DropShipOrders.seam?javax.portlet.faces.DirectLink=true'} )">     <option value="org.jboss.seam.ui.NoSelectionConverter.noSelectionValue">Select...</option>
                           <option value="0">Bold Hardware Co.</option>
                      
                           <option value="1">Charles McMurray</option>
                      </select>




                      How do I get the vendorId field to populate the value in the select item? I though that I had it configured properly.


                      Thanks Ingo.


                      • 8. Re: Component Injection & h:selectOne with a4jsupport
                        Ingo Jobling Master

                        The option values you are seeing in the HTML output are assigned by entityConverter, don't expect to see the actual ids because entityConverter maintains a cache of object instances, and these values are the index into the cache. 


                        Try adding a @PreUpdate method to the Product entity and set a breakpoint on it.  This should (hopefully) allow you to examine the Product and the Vendor before the exception is thrown and see what is wrong.


                        If not, attach the hibernate source and set a breakpoint in the Cascade method which is reporting the error, again, this should give you a chance to examine the objects just before the exception is thrown.






                        • 9. Re: Component Injection & h:selectOne with a4jsupport
                          Ingo Jobling Master

                          Also, set log4j to trace level for org.hibernate.

                          • 10. Re: Component Injection & h:selectOne with a4jsupport
                            john mcdonald Newbie

                            I got it to work! This problem has been so painful that I want to contribute the fix so that others will know how to correct these errors. Bear with me, I'm going to walk through the series of errors and corrections that lead to my discovery of the fix.


                            Thank you to Ingo for pointing me in the right direction. His comment:



                            The key thing in the stacktrace is

                            Caused by java.lang.IllegalStateException with message: "org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xeosuite.xeoadmin.entity.Product.vendor -> com.xeosuite.xeoadmin.entity.Vendor"
                            




                            This got me thinking about Hibernate and I remember reading in other forums (link) where someone had solved this error by adding the following cascade to the setter method of the Entity (Product.setVendor in my case).


                            cascade=CascadeType.PERSIST
                            



                            So that's what I did to resolve the TransientObjectException error. Now for the next error which was:


                            [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - failed for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@1bc21fd
                            javax.persistence.PersistenceException: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
                            



                            So I googled the hell out of this error and found another forum post suggesting that the two entities were loaded from two different hibernate sessions. OH! That got me thinking about YET ANOTHER forum post that I read two days earlier about using the Seam entity manager


                            @In private EntityManager entityManager;



                            instead of the standard entity manager.


                            @PersistenceContext
                            private EntityManager em;
                            



                            When I created my DropShipVendorAction component I took this advice and used the seam persistence manager. Today it hit me! I'm using two Action components to populate this page; DropShipOrdersAction and DropShipVendorAction. DropShipVendorAction was using the seam entity manager, while DropShipOrdersAction was still using the standard entity manager. I switched the entity manager in DropShipOrdersAction to seam and BAM! It worked!!


                            Here's the entire working code base as reference (This works great!!) Once again, thank you Ingo for your help.


                            DropShipOrdersAction


                            @Stateful
                            @Name("DropShipOrders")
                            public class DropShipOrdersAction implements DropShipOrders {
                            
                                @Logger private Log log;
                                
                                @In FacesMessages facesMessages;
                               
                                @In private EntityManager entityManager;
                            
                                @DataModel 
                                List<Orders> dropShipOrdersList;
                                
                                @DataModelSelection
                                Orders order;
                                
                                @Factory(scope=ScopeType.CONVERSATION)
                                public List<Orders> getDropShipOrdersList() {
                                     dropShipOrdersList = entityManager.createQuery("select o from Orders o where o.orderId In(13247,13115)").getResultList();
                                     return dropShipOrdersList;
                                }
                                 
                                 public void transmitOrder(){
                                      if( order != null) {
                                           log.info("DropShipOrders.transmitOrder Order "+order.getOrderId()+" IS NOT Null");
                                           order.setStatus("Processing");
                                           entityManager.persist(order);
                                           //dropShipOrdersList.remove(order);
                                      }
                                      log.info("DropShipOrders.transmitOrder Called");
                                 }
                                 
                                  @Destroy @Remove                                                                      
                                  public void destroy() {}
                                 
                            }
                            



                            DropShipVendorAction


                            @Stateful
                            @Name("DropShipVendor")
                            public class DropShipVendorAction implements DropShipVendor {
                            
                                @Logger private Log log;
                                
                                @In FacesMessages facesMessages;
                               
                                @In private EntityManager entityManager;
                                
                                @In (required=false)
                                Orderitem orderitem;
                            
                                private Vendor vendor;
                                
                                public List<Vendor> getVendorList() {
                                     List<Vendor> vendorList =  entityManager.createQuery("select v from Vendor v where v.company In('Bold Hardware Co.','Charles McMurray')").getResultList();
                                     return vendorList;
                                }
                                
                                public Vendor getVendor() {
                                     return vendor;
                                }
                                
                                public void setVendor(Vendor vendor) {
                                     log.info("DropShipVendor.setVendorID action called with: "+vendor.getCompany());
                                      log.info("DropShipOrders.setVendorID Orderitem Null: "+(orderitem==null));
                                      //log.info("DropShipOrders.setVendorID Order Null: "+(order==null));
                                      //log.info("DropShipOrders.setVendorID EM Null: "+(em==null));
                                      facesMessages.add("Vendor #{vendor.company}");
                                     this.vendor = vendor;
                                }
                                 
                                  @Destroy @Remove                                                                      
                                  public void destroy() {}
                            
                            }
                            



                            DropShipOrders.xhtml


                            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                                                         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                            
                            
                            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                                 xmlns:s="http://jboss.com/products/seam/taglib"
                                 xmlns:ui="http://java.sun.com/jsf/facelets"
                                 xmlns:f="http://java.sun.com/jsf/core"
                                 xmlns:h="http://java.sun.com/jsf/html"
                                 xmlns:a="http://richfaces.org/a4j"
                                 xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">
                            
                                 <ui:define name="body">
                            
                                      <rich:panel id="messages">
                                          <h:messages styleClass="message"/>
                                     </rich:panel>
                            
                                      <h:form id="ordersSearch" styleClass="edit">
                            
                                           <rich:simpleTogglePanel label="Orders search parameters"
                                                switchType="ajax">
                                                <s:decorate template="layout/display.xhtml">
                                                     <ui:define name="label">Order Number</ui:define>
                                                     <h:inputText id="orderNumber" value="#{ordersList.orders.orderNumber}" />
                                                </s:decorate>
                                           </rich:simpleTogglePanel>
                            
                                           <div class="actionButtons"><h:commandButton id="search"
                                                value="Search" action="/DropShipOrders.xhtml" /></div>
                            
                                      </h:form>
                            
                                      <rich:panel>
                                           <f:facet name="header">Orders search results</f:facet>
                                           <div class="results" id="ordersList">
                                           
                                           <rich:dataTable
                                                id="ordersList" var="_orders" value="#{DropShipOrders.dropShipOrdersList}"
                                                rendered="#{not empty ordersList.resultList}">
                                            
                                                <!-- <f:facet name="header"> -->
                                                     <rich:columnGroup style="border:1px solid #FFFFBB;background: #A99999;color: white;">
                                                        <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                                        <f:facet name="header">
                                                               <h:outputText value="spacer" />
                                                           </f:facet>
                                                           Order ID</rich:column>
                                                        <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                                        <f:facet name="header">
                                                               <h:outputText value="spacer" />
                                                           </f:facet>
                                                           Customer</rich:column>
                                                        <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                                        <f:facet name="header">
                                                               <h:outputText value="spacer" />
                                                           </f:facet>
                                                           Company</rich:column>
                                                        <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                                        <f:facet name="header">
                                                               <h:outputText value="spacer" />
                                                           </f:facet>
                                                           Status</rich:column>
                                                           <rich:column style="font-size:12px;font-weight:bold;text-align:left" colspan="1">
                                                        <f:facet name="header">
                                                               <h:outputText value="spacer" />
                                                           </f:facet>
                                                           Action</rich:column>
                                                    </rich:columnGroup>
                                                    
                                                <!-- </f:facet> -->
                                                <rich:columnGroup style="vertical-align: top;height:25px">
                                                     <rich:column  colspan="1">
                                                          <h:outputText value="#{_orders.orderId}" />
                                                     </rich:column>
                                                     <rich:column   colspan="1">
                                                          <h:outputText value="#{_orders.customer.firstName} #{_orders.customer.lastName}" />
                                                     </rich:column>
                                                     <rich:column  colspan="1">
                                                          <h:outputText value="#{_orders.customer.organization}" />
                                                     </rich:column>
                                                     <rich:column  colspan="1">
                                                          <h:outputText value="#{_orders.status}" />
                                                     </rich:column>
                                                     <rich:column colspan="1">
                                                           <h:form>
                                                               <h:commandLink value="test" action="#{DropShipOrders.transmitOrder}"/>
                                                          </h:form>
                                                      </rich:column>
                                                </rich:columnGroup>     
                                                
                                                <rich:subTable var="_orderitem" value="#{_orders.orderitems}">
                                                    <rich:column>
                                                         <f:facet name="header">Vendor</f:facet>
                                                                <h:form  styleClass="edit">        
                                                                   <!--  <h:inputHidden id="orderItem" value="#{_orderitem}"/> -->
                                                                   <h:outputText id="venorName" value="#{_orderitem.product.vendor.company}"></h:outputText>
                                                                     <h:selectOneMenu value="#{_orderitem.product.vendor}">
                                                                            <s:selectItems value="#{DropShipVendor.vendorList}" noSelectionLabel="Select..." var="vendor" label="#{vendor.company}" />
                                                                            <s:convertEntity/>
                                                                            <a:support event="onchange" reRender="ovenorName" focus="venorName" process="_orderitem" ajaxSingle="true"/>
                                                                         </h:selectOneMenu>                
                                                                   </h:form>
                                                              <f:facet style="height : 25px;" name="ass">test<rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                                    </rich:column> 
                                                    <rich:column>
                                                         <f:facet name="header">Qty</f:facet>
                                                        <h:outputText value="#{_orderitem.quantity}"></h:outputText>
                                                        <f:facet style="height : 25px;" name="ass"><rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                                    </rich:column>
                                                    <rich:column>
                                                         <f:facet name="header">Product</f:facet>
                                                        <h:outputText value="#{_orderitem.product.name}"></h:outputText>
                                                        <f:facet style="height : 25px;" name="ass"><rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                                    </rich:column>
                                                    <rich:column >
                                                         <f:facet name="header">Model</f:facet>
                                                        <h:outputText value="#{_orderitem.code}"></h:outputText>
                                                        <f:facet style="height : 25px;" name="ass">this si a test<rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                                    </rich:column>
                                                    <rich:column >
                                                         <f:facet name="header">Action</f:facet>
                                                        <h:outputText value="#{_orderitem.code}"></h:outputText>
                                                        <f:facet style="height : 25px;" name="ass">this si a test<rich:spacer style=" width : 26px; height : 25px;"></rich:spacer></f:facet>
                                                    </rich:column>
                                                </rich:subTable>
                                                
                                                <rich:columnGroup style="height:50px;border:none;">
                                                     <rich:column colspan="5"></rich:column>
                                                </rich:columnGroup>
                                            </rich:dataTable>
                                           </div>
                                      </rich:panel>
                            
                                      <div class="tableControl"><s:link view="/OrdersList.xhtml"
                                           rendered="#{ordersList.previousExists}"
                                           value="#{messages.left}#{messages.left} First Page" id="firstPage">
                                           <f:param name="firstResult" value="0" />
                                      </s:link> <s:link view="/OrdersList.xhtml"
                                           rendered="#{ordersList.previousExists}"
                                           value="#{messages.left} Previous Page" id="previousPage">
                                           <f:param name="firstResult" value="#{ordersList.previousFirstResult}" />
                                      </s:link> <s:link view="/OrdersList.xhtml" rendered="#{ordersList.nextExists}"
                                           value="Next Page #{messages.right}" id="nextPage">
                                           <f:param name="firstResult" value="#{ordersList.nextFirstResult}" />
                                      </s:link> <s:link view="/OrdersList.xhtml" rendered="#{ordersList.nextExists}"
                                           value="Last Page #{messages.right}#{messages.right}" id="lastPage">
                                           <f:param name="firstResult" value="#{ordersList.lastFirstResult}" />
                                      </s:link></div>
                            
                                      <s:div styleClass="actionButtons" rendered="#{empty from}">
                                           <s:button view="/OrdersEdit.xhtml" id="create" value="Create orders">
                                                <f:param name="ordersOrderId" />
                                           </s:button>
                                      </s:div>
                            
                                 </ui:define>
                            
                            </ui:composition>
                            



                            Product entity getVendor method


                            @ManyToOne(fetch = FetchType.LAZY, cascade=CascadeType.PERSIST)
                                 @JoinColumn(name = "vendorID")
                                 public Vendor getVendor() {
                                      return this.vendor;
                                 }
                            

                            • 11. Re: Component Injection & h:selectOne with a4jsupport
                              Ingo Jobling Master

                              Glad to hear you got it working!  Hats off to you for not giving up :-)