1 Reply Latest reply on Nov 15, 2002 1:34 PM by auswalk

    Session bean and DO

    auswalk

      This is crazy. I am porting my code from resin-ee and this worked fine before. Here's the code:

      public Collection getSavedEcoAnalysis(int userid)

      {
      SavedEcoAnalysisLocalHome home = this.getSavedEcoAnalysisHome();

      Collection coll = null;
      try {
      coll = home.findByUserId(userid);
      } catch (FinderException fe) { return new ArrayList(); }
      ArrayList aList = new ArrayList();

      Iterator iter = coll.iterator();

      while (iter.hasNext()) {
      SavedEcoAnalysis bean = (SavedEcoAnalysis)iter.next();
      CalculatorDO data = (CalculatorDO)bean.getData();
      CalculatorAnalysisDO analysisData = (CalculatorAnalysisDO)bean.getAnalysisData();

      data.setId(bean.getId().intValue());
      data.setUserID(bean.getUserId());
      data.setName(bean.getName());
      data.setComments(bean.getComments());

      // aList.add(bean.getData());
      System.out.println("******Adding ID -- " + data.getId() + " ***********");
      System.out.println("******Adding Name -- " + data.getName() + " ***********");

      aList.add(data);
      }
      return aList;

      }


      Now essentially i'm modifying some fields in "CalculatorDO" object before returning this objects in a collection to the client (web tier). The crazy part is, none of these values are retained in the client. When I iterate thru the collection and try to get the "id" for example, it's value is "0" instead of what I set it to. I have placed printlns and stepped thru numerous times and something is wrong.

      Another thing though, is the values in the CalculatorDO object that were previously set (i.e. not inside this method above) **ARE** retained when passed back to the client.

      Thanks for any help.

        • 1. Re: Session bean and DO
          auswalk

          THis is absolutely maddening. The session bean makes changes to the DO returned by the entitybean, but when it's passed over the wire those changes are lost in the dataobject. Something is arai.