0 Replies Latest reply on Apr 30, 2004 12:29 PM by stille

    Problems with EJB 1.1 Entity BMP commit-options and cached b

    stille

      Hello.
      I have a big problem: I´m migrating an application from jboss 2.0 to 3.2.3 The application works just fine in 2.0, but in 3.2.3 we have problems with some EJB´s 1.1.
      The thing is that one EJB 1.1 bean does an ejbCreate, and then returns to another EJB 1.1 bean the PK of the created object. At this point, the container should have to do a ejbLoad to retrieve the proper info of the object in order to synchronize ir, and give it to me, but it´s not doing that.
      I tried changing all the <commit-option> from the file standardjboss.xml to D, C and even B, but none of this made the HOME interfase to do de ejbLoad.
      What´s going on? Do I have to change some other configuration file???

      Here´s a portion of the code:

      The EJB 1.1 TaxAssessmentADMBean (Session) do this in one of it´s methods:
      // Get JNDI reference
      TaxAssessmentHome assessmentHome =
      (TaxAssessmentHome)new ServiceLocator().getRemoteHome(
      "TaxAssessment",
      TaxAssessmentHome.class);

      assessmentItem = assessmentHome.create(
      taxableObjectId,
      taxPayerId,
      ujc,
      type,
      xmlAssessment,
      userId,
      period,
      version);
      //In assessmentItem i have an assessmentId = 0, as if the object didn´t retrieve the info from the DB
      logger.debug("assessment created ID :" + assessmentItem.getAssessmentId());

      return assessmentItem.getAssessmentId();

      In the EJB 1.1 TaxAssessmentBean (Entity BMP) we have this ejbCreate method:
      public TaxAssessmentPK ejbCreate(
      long taxableObjectId,
      long taxpayerId,
      long ujc,
      java.lang.String type,
      java.lang.String xmlData,
      long userId,
      long period,
      long version) throws CreateException
      {
      logger.debug("ejbCreate");
      /*PreparedStatement prepStmtGet = null;
      PreparedStatement preStmtInsertClob = null;
      PreparedStatement prepStmtUpdateClob = null;
      PreparedStatement prepUpdateXMLType = null;*/

      logger.debug("Create");
      Connection con = null;
      long ID = 0;
      try
      {
      this.taxableObjectId = taxableObjectId;
      this.taxpayerId = taxpayerId;
      this.ujc = ujc;
      this.assessmentType = type;
      this.xmlData = xmlData;
      // this.assessmentDate = assessmentDate;
      this.userId = userId;
      this.period = period;
      this.version = version;

      con = new ServiceLocator().getDBConn(ServiceLocator.TAXDB_JNDINAME);

      CallableStatement cs =
      con.prepareCall(
      "{? = call ast$abm.actioninsert(?,?,?,?,?,?,?,?,?)}");
      // stored func
      cs.registerOutParameter(1, Types.NUMERIC);
      cs.setLong(2, this.ujc);
      cs.setLong(3, this.taxableObjectId);
      cs.setLong(4, this.taxpayerId);
      cs.setString(5, this.assessmentType);
      cs.setString(6, this.xmlData);
      // cs.setClob(6, clob);
      cs.setDate(7, this.assessmentDate);
      cs.setLong(8, this.userId);
      cs.setLong(9, this.period);
      cs.setLong(10, this.version);
      cs.executeUpdate();
      //clob.freeTemporary();
      ID = cs.getLong(1);

      logger.debug("ID CREADA ["+cs.getLong(1)+"]");

      }
      catch(Exception e)
      {
      throw new EJBException(
      "TaxAssessment EJBException ejbCreate :" + e.toString());
      }
      finally
      {
      try
      {
      if(con != null)
      {
      con.close();
      logger.debug("libere conexion de ejbCreate " + con.toString());
      }
      }
      catch(Exception e)
      {
      }
      /* try { if (prepStmtGet != null) { prepStmtGet.close(); } }
      catch(Exception e) {}
      try { if (preStmtInsertClob != null) { preStmtInsertClob.close(); } }
      catch(Exception e) {}
      try { if (prepStmtUpdateClob != null) { prepStmtUpdateClob.close(); } }
      catch(Exception e) {}
      try { if (prepUpdateXMLType != null) { prepUpdateXMLType.close(); } }
      catch(Exception e) {} */
      }
      return new TaxAssessmentPK(ID);
      }

      As you can see, the code is just fine, and it works excellent in jboss 2.0! The Entity Bean TaxAssessment returns a TaxAssessmentPK to the HOME object, and this one should call ejbLoad to synchronize data, and it doesn´t. As I said, in jboss 2.0 it does it cause we see it in the logs, but in jboss 3.2.3 it doesn´t

      Thanks a lot,
      Nicolás