2 Replies Latest reply on Jun 19, 2003 12:07 AM by peixubin peixubin

    update is happened when  I'm running FindByXXX.

    peixubin peixubin Newbie

      The code is:
      YhdaBean.java:
      ...
      /*primary key field*/
      public abstract String getHh();
      public abstract void setHh(String hh);
      public abstract Collection getLszs();
      public abstract void setLszs(Collection c);

      ...

      LszBean.java:
      ...
      public abstract String getHh();
      public abstract void setHh(String hh);
      public abstract YhdaLocal getYhda();
      public abstract void setYhda(YhdaLocal yhdaLocal);
      ...
      ejb-jar.xml:
      ...
      <ejb-relation >
      <ejb-relation-name>YD.YHDA-cmp20-*-PXB.LSZ-cmp20</ejb-relation-name>
      <!-- bidirectional -->
      <ejb-relationship-role >
      <ejb-relationship-role-name>YD.YHDA-cmp20-has-PXB.LSZ-cmp20</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>Yhda</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>Lszs</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role >
      <ejb-relationship-role-name>PXB.LSZ-cmp20-has-YD.YHDA-cmp20</ejb-relationship-role-name>
      Many
      <relationship-role-source >
      <ejb-name>Lsz</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>yhda</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>
      ...
      jbosscmp-jdbc.xml
      ...
      <ejb-relation>
      <ejb-relation-name>YD.YHDA-cmp20-*-PXB.LSZ-cmp20</ejb-relation-name>
      <foreign-key-mapping/>
      <ejb-relationship-role>
      <ejb-relationship-role-name>YD.YHDA-cmp20-has-PXB.LSZ-cmp20</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>hh</field-name>
      <column-name>HH</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>PXB.LSZ-cmp20-has-YD.YHDA-cmp20</ejb-relationship-role-name>
      <fk-constraint>true</fk-constraint>
      <key-fields/>
      </ejb-relationship-role>
      </ejb-relation>

      ...



      deploy it into jboss,run LszLocalHome.findByXXX method,the server.log of jboss print following messages:
      ...
      2003-06-13 16:43:22,250 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.JhLsz.findByJzrq] Executing SQL: SELECT t0_o.XH, t0_o.HH, t0_o.RQ, t0_o.QS, t0_o.FSJE, t0_o.KHZH, t0_o.KHYH, t0_o.JZRQ, t0_o.ZJLSH, t0_o.WYJ, t0_o.WYTS, t0_o.DWBH, t0_o.CZR, t0_o.DZBZ, t0_o.KKBZ, t0_o.SJPC, t0_o.YSJE, t0_o.SSDF, t0_o.SSWYJ, t0_o.JZSJ, t0_o.FYLB, t0_o.JFFS, t0_o.WTBH, t0_o.YHLX, t0_o.JYM, t0_o.HH FROM PXB.LSZ t0_o WHERE t0_o.JZRQ = ? AND t0_o.KHYH = ? AND t0_o.JYM = ?
      ...
      2003-06-13 16:43:24,390 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.JhLsz] Executing SQL: UPDATE PXB.LSZ SET HH=? WHERE XH=?
      2003-06-13 16:43:24,390 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.JhLsz] Rows affected = 1
      2003-06-13 16:43:24,390 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.JhLsz] Executing SQL: UPDATE PXB.LSZ SET HH=? WHERE XH=?
      2003-06-13 16:43:24,406 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.JhLsz] Rows affected = 1
      2003-06-13 16:43:24,406 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.JhLsz] Executing SQL: UPDATE PXB.LSZ SET HH=? WHERE XH=?