2 Replies Latest reply on Feb 21, 2011 11:13 PM by Tim Evers

    Logging user activity

    Stuart Douglas Master

      I have seen a few requests on the forum for information on how to log user request details.


      I have added a knowledge base article here on the solution I came up with.

        • 1. Re: Logging user activity
          ananymous7239 Newbie

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


          Hi Stuart i want to save 5 uploaded images as 5 records in Database
          .you have any idea about this please help me .i am able to save only the last upload 
          image. this is my persist method
          @Override
               @Begin(join = true)
               @End
               public String persist() {
                    try {
                         BeanUtils.copyProperties(getInstance(), doImageUpload);
          
                         for (int num = 0; num < files.size(); num++) {
          
                              getInstance().setData(files.get(num).getData());
                              getInstance().setLength(files.get(num).getData().length);
                              log.info("...............files in persist"+files.get(num).getLength());
                              log.info("...............files in persist"+files.size());
                              log.info("...............files in persist"+files.get(num).getData());
          
                         }
                         super.persist();
          
                    } catch (Exception e) {
                         log.info("exception" + e);
                    }
                    return "done";
          
               }



          • 2. Re: Logging user activity
            Tim Evers Master

            venu gopal wrote on Feb 21, 2011 00:29:


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

            Hi Stuart i want to save 5 uploaded images as 5 records in Database
            .you have any idea about this please help me .i am able to save only the last upload 
            image. this is my persist method
            @Override
                 @Begin(join = true)
                 @End
                 public String persist() {
                      try {
                           BeanUtils.copyProperties(getInstance(), doImageUpload);
            
                           for (int num = 0; num < files.size(); num++) {
            
                                getInstance().setData(files.get(num).getData());
                                getInstance().setLength(files.get(num).getData().length);
                                log.info("...............files in persist"+files.get(num).getLength());
                                log.info("...............files in persist"+files.size());
                                log.info("...............files in persist"+files.get(num).getData());
            
                           }
                           super.persist();
            
                      } catch (Exception e) {
                           log.info("exception" + e);
                      }
                      return "done";
            
                 }






            Your question does not relate to what Stuart is talking about. Create a new topic for people to respond to. But, your problem is simple, if you want to save 5 files to a database then stop trying to put them all into the same object instance. Every time you call getInstance().setData(xxxxx) you are overwriting what was there. This is simple java object stuff nothing to do with database or seam or hibernate or any framework at all.