0 Replies Latest reply on Dec 1, 2009 4:21 PM by Ilya Dyoshin

    EntityQuery.refresh() doesn't refreshes. :(

    Ilya Dyoshin Novice

      Good day community.


      I've created a simple page with datatable and modalPanel for CRUD operations with simple entity (2 text fields).


      now I'm stuck with entityManager behaviour. When I update mine entity during ajax request the datatable shows edited content. If I create a new one or delete existing entity refreshed datatable shows it. Only If I change conversation context and fully reload page the new entities begin to show or deleted disappears.


      I'm using  very simple model:


      EntityQuery:


      @Name("sprAddressTypeEntityQuery")
      @Scope(ScopeType.CONVERSATION)
      public class SprAddressTypeEntityQuery extends EntityQuery<SprAddressType>{
           
           @In(create=true)
           SprAddressTypeEntityHome sprAddressTypeEntityHome;
           
           private static final long serialVersionUID = -5078849295341605011L;
           private static String EJBQL = "SELECT o FROM SprAddressType o";
           
           public SprAddressTypeEntityQuery() {
                super();
                super.setEjbql(EJBQL);
           }
      
      }





      EntityHome:


      @Name("sprAddressTypeEntityHome")
      @Scope(ScopeType.CONVERSATION)
      public class SprAddressTypeEntityHome extends CommonEntityHome<SprAddressType>{
      
           private static final long serialVersionUID = 4731102106688238993L;
           
           @Logger
           Log log;
      
      }
      



      and in my page : I have following button:



      <a4j:commandButton action="#{sprAddressTypeEntityHome.save()}" value="Зберегти" >
         <a4j:support action="#{sprAddressTypeEntityQuery.refresh()}" event="oncomplete" 
            oncomplete="if (!ajaxRequestContainsErrors()) Richfaces.hideModalPanel('editorPanel');"/>                              
      </a4j:commandButton>



      And the whole datatable is inside of the a4j:outputPanel.