3 Replies Latest reply on Apr 29, 2008 11:25 PM by T Rixom

    getEntityManager().remove

    T Rixom Newbie

      HI,


      I am struggling with the removing of an entity using


      getEntityManager().remove


      The problem is that when I call the function i can see the entity has been removed from the EntityManager, but the actual SQL command has not been issued.


      Only when I log out (close the conversation) or start a nested one do I see the actual sql command being executed.


      Any ideas?


      T.

        • 1. Re: getEntityManager().remove
          T Rixom Newbie

          BTw, this is the code in the xhtml:


          <h:commandButton
                                                  id="Delete"
                                                  value="#{messages.delete}"
                                                  image="#{facesContext.externalContext.requestContextPath}/../img/delete.gif"
                                                  action="#{parentList.delete(user)}" 
                                                  immediate="true"
                                                  rendered="#{not parentList.managed}" />
          



          This code is part of a dataTable that iterates through a Set of users.


          The delete function is located in the EntityQuery used to get the ResultList of users.


          T.

          • 2. Re: getEntityManager().remove
            Joseph Nusairat Newbie

            Click HELP for text formatting instructions. Then edit this text and check the preview.


            Try explicitly flushing the call after remove.


            It's probably waiting till the transaction has ended to do it.

            • 3. Re: getEntityManager().remove
              T Rixom Newbie

              HI,


              flushing the entitymanager resulted in a notransaction error.


              The problem is a similiar problem to what I have been having with Seam. If you change an object and then use this object (in another list fr example) before it can persist the delete is nullified.


              Thanks


              T.