Well, i reconfigured the managed persistence context as follows 

  | <core:managed-persistence-context name="entityManager" auto-create="true" 
persistence-unit-jndi-name="java:/tradeWindsEntityManagerFactory"/>
  |                     
  |     
  |     <selectitems:config no-selection-label="-" 
entity-manager="#{entityManager}"/>
  | 

The managed persistence context is properly injected now in the following bean


  | @Stateful
  | @Name("standManager")
  | public class StandObjectBean implements StandObjectLocal{        
  |     
  |     @Out(required=false)
  |     @In(required=false)
  |     private StandDTO stand;
  |     
  |     @In
  |     private EntityManager entityManager;         
  |     
  |     @In
  |     private FacesMessages facesMessages;
  |     
  |     @Out(required=false)
  |     @In(required=false)
  |     private PavilionDTO pavilion;            
  |     
  |     public static String ADMIN_LIST = "marketing/admin/stands";    
  |     
  |     /** Creates a new instance of StandObjectBean */
  |     public StandObjectBean() {
  |     }
  | 
  |     @Begin
  |     public String createObject() {
  |         stand = new StandDTO();        
  |         return NEW;
  |     }
  | 
  |     @End
  |     public String cancel() {
  |         return ADMIN_LIST;
  |     }
  | 
  |     @End
  |     public String saveObject() {
  |         new StandBO(entityManager).save(stand);        
  |         facesMessages.add("New stand added");
  |         return ADMIN_LIST;
  |     }
  | 
  |     @Destroy
  |     @Remove
  |     public void destroy() {
  |     }
  | 
  |     @Factory("pavilionList")
  |     public List<LocationDTO> createPavilionList(){
  |         return new PavilionBO(entityManager).findAll();
  |     }
  |     @Factory("standTypeList")
  |     public List<StandTypeDTO> createStandTypeList(){
  |         return new StandTypeBO(entityManager).findAll();
  |     }
  |     
  | }
  |  
  | 

and my page is as ff:


  |                             <div class="label"><h:outputLabel 
for="pavilion" value="Pavilion "/></div>                             
  |                            <div class="input">                              
      
  |                                         <h:selectOneMenu id="pavilion" 
value="#{stand.pavilion}" required="true">
  |                                             <si:selectItems 
value="#{pavilionList}" var="pav" label="#{pav.title}"/>                        
                     
  |                                         </h:selectOneMenu>                  
                  
  |                                         <br/>                               
         
  |                                 </div>     
  |                         
  |                              <h:commandButton id="save" 
action="#{standManager.saveObject}" value="Save"/>
  |                               
  |                              <h:commandButton id="cancel" immediate="true" 
action="#{standManager.cancel}" value="Cancel"/>                                
                      
  | 

All my entities already use id equality, so i don't think that will be a 
problem. The most annoying part of this is that i don't get any exception so i 
can know what i'm doing wrong. the page just doesn't respond when i click the 
h:commandButton "Save", though as you can see bean has a saveObject method.

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

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

Reply via email to