1 2 Previous Next 22 Replies Latest reply on Nov 23, 2005 5:24 PM by svetsch Go to original post
      • 15. Re: Using saveOrUpdate()
        gavin.king

        Well, sorry, but you'll need to simplify things before I can help you any further. It seems that your problem is in trying to get everything to work in one big bang instead of starting with the examples included in the Seam download and working from there, one step at a time.

        • 16. Re: Using saveOrUpdate()
          nusa

           

          "gavin.king@jboss.com" wrote:
          Submit a runnable zip of your project to JIRA, and I will take a quick look.

          Done, it's JBSEAM-96.
          Thanks.

          • 17. Re: Using saveOrUpdate()
            xiangya

            hi,
            try to add a little modification and remove @In
            and @Out annotation at project field.

            maybe you have no need to inout project field with
            other control action object.

            • 18. Re: Using saveOrUpdate()
              nusa

               

              "xiangya" wrote:
              hi,
              try to add a little modification and remove @In
              and @Out annotation at project field.

              maybe you have no need to inout project field with
              other control action object.

              Hi,

              I need @In in order to 'save' or 'insert' the data, otherwise it won't.
              I tried to remove @Out, put it back, specify the values, etc, yet it still
              won't update. I don't have any more idea.



              • 19. Re: Using saveOrUpdate()
                nusa

                Gavin,

                Any chance you will take a look at JBSEAM-96 ?

                Thanks.

                • 20. Re: Using saveOrUpdate()
                  xiangya

                  hi,
                  checked your code, you use local var "project" in ProjectAction, but you did not assigned value for it,just use @In(created=true), so every value of project var is always new Project.
                  pls see note between two lines//////////////////////////

                  @IfInvalid(outcome=REDISPLAY)
                   public String markForEdition() {
                   log.info("=== markForEdition ...");
                  
                   log.info("=== get dataAction ...");
                   DataAction data = (DataAction)Contexts.getEventContext().get("dataAction");
                  
                   //log.info("=== The obj is " + data.getClass().getName());
                   UIData table = data.getTable();
                   //CoreTable table = data.getTable();
                  
                   if ( table.isRowAvailable() ) {
                  //////////////////////
                  at this
                  maybe you want proejct=(Project)table.getRowData();
                  //////////////////////
                   Project prj = (Project) table.getRowData();
                   log.info("=== Attempting to update a row : " + prj.toString());
                  
                   prj = (Project)hibernateSession.merge(prj);
                   //hibernateSession.update(project);
                   //hibernateSession.saveOrUpdate(prj);
                   return "success";
                   } else {
                   log.info("=== Couldn't find row !!!");
                   }
                  
                   return null;
                   }


                  • 21. Re: Using saveOrUpdate()
                    nusa

                    I already did that combination, but still not working (not commited in the database ).

                    • 22. Re: Using saveOrUpdate()
                      svetsch

                      Did you solve your problem ?

                      I'm having the same problem, but only if I do an update in a CONVERSATION scope, where I'm trying to update an object that was loaded and changed in a previous request but in the same conversation. If my controller is in the EVENT scope, everything works well (ChangePasswordAction) in noEJB booking example.

                      In other words,

                      This is not working, i.e. no database update is done

                      @End
                      public String update() {
                       portfolio = (AmcPortfolio)session.merge(portfolio);
                       return "main";
                      }
                      

                      I get the following message :
                      (DefaultMergeEventListener.java:entityIsPersistent:124) -ignoring persistent instance



                      But this is working (no business meaning, but interesting):
                      @End
                      public String update() {
                       session.refresh(portfolio);
                       portfolio.setPortfolioName("TEST");
                       portfolio = (AmcPortfolio)session.merge(portfolio);
                       return "main";
                      }
                      


                      Any help welcome !

                      1 2 Previous Next