3 Replies Latest reply on May 15, 2002 11:55 AM by starco

    CMR 2.0 and foreing key bug?

    starco

      Hello all.

      I have 2 bean and 2 relationships beween them. First relationship is one-many, second - one-one. The one bean has two foreing key columuns to another bean. When I call methods that use one-one relationships I get an exception:
      java.sql.SQLException: ORA-00972: identifier is too long.
      The server think that one of the tables has in data base the following columns:
      BOAgrigationEnrollmentBean_agrregatedBOEntity_agregatedBOID and BOAgrigationEnrollmentBean_agrregatedBOEntity_businessObjectID
      But they doesn't exist here.

      I use JBoss 3.0 RC1 and Oracle9i.

      The database details:
      I have two tables between which I have 2 relationhips.
      1. table BorCbo with columns
      cboId - pk
      identity
      defId
      2. table BorAgrigation with columns
      cboId - fk to table BorCbo
      agrigatedCboId - fk to table BorCbo
      agrIdentifier
      agrNumber
      There are 2 foreing keys to table BorCbo. The first foring key "cboId" is used by one-many relationships with ejb-relation-name "BOEntityBean.agrigationEnrollment-BOAgrigationEnrollmentBean".
      The second "agrigatedCboId" is used by one-one relationships with ejb-relation-name "ArgregationBORelationship".

      The ejb details.
      1. The entity bean BOEntityBean works with table BorCbo. There exist 2 cmp-fields (mapped in bosscmp-jdbc.xml):
      businessObjectID for cboId
      identity for identity
      And 1 cmr-field agrigationEnrollment for one-to-many relationships "BOEntityBean.agrigationEnrollment-BOAgrigationEnrollmentBean". This relation is described from BOEntityBean side as:
      <key-fields>
      <key-field>
      <field-name>businessObjectID</field-name>
      <column-name>cboId</column-name>
      </key-field>
      </key-fields>


      2. The entity bean BOAgrigationEnrollmentBean works with table BorAgrigation There exist 4 cmp-fields (mapped in bosscmp-jdbc.xml):
      businessObjectID for cboId
      number for agrNumber
      agregatedBOIdentifier for agrIdentifier
      agregatedBOID for agrigatedCboId
      And 1 cmr-field agrregatedBOEntity for one-to-one relationship "ArgregationBORelationship". This relation is described from BOEntityBean side as:
      <key-fields>
      <key-field>
      <field-name>businessObjectID</field-name>
      <column-name>agrigatedCboId</column-name>
      </key-field>
      </key-fields>

      The beans have deployed succesful. But during work the server throws java.sql.SQLException: ORA-00972: identifier is too long. The SQL statement (from server.log):
      INSERT INTO BORCBO (cboId, identity, BOAgrigationEnrollmentBean_agrregatedBOEntity_agregatedBOID, BOAgrigationEnrollmentBean_agrregatedBOEntity_businessObjectID, defId) VALUES (?, ?, ?, ?, ?)
      Two colum names are very strange for me:
      BOAgrigationEnrollmentBean_agrregatedBOEntity_agregatedBOID and BOAgrigationEnrollmentBean_agrregatedBOEntity_businessObjectID
      The table BorCbo in db does not contains these colums. But JBoss thinks that they exist.
      It seems, these strange columns form by pattern: ejb-name-of-relationship-role-source_cmr-field-name_cmp-filed-for-fk.
      Example:
      ejb-name-of-relationship-role-source = BOAgrigationEnrollmentBean
      cmr-field-name = agrregatedBOEntity
      cmp-filed-for-fk = agregatedBOID (or businessObjectID)

      Why JBoss think that there columns exist in table?


      I have checked this file and found only 2 encountered entries with strange columns.
      1. 2002-05-03 10:03:14,215 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.BOEntityBean] Insert Entity SQL: INSERT INTO BORCBO (cboId, identity, BOAgrigationEnrollmentBean_agrregatedBOEntity_agregatedBOID, BOAgrigationEnrollmentBean_agrregatedBOEntity_businessObjectID, defId) VALUES (?, ?, ?, ?, ?)

      and

      2. 2002-05-02 17:50:18,415 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.BOEntityBean] Executing SQL: SELECT identity, BOAgrigationEnrollmentBean_agrregatedBOEntity_agregatedBOID, BOAgrigationEnrollmentBean_agrregatedBOEntity_businessObjectID, defId FROM BORCBO WHERE (cboId=?)
      2002-05-02 17:50:18,475 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException, causedBy:
      java.sql.SQLException: ORA-00972: identifier is too long

      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
      at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1451)
      at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:651)
      at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2117)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:23 31)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatemen t.java:422)
      at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement .java:366)
      at org.jboss.resource.adapter.jdbc.local.PreparedStatementInPool.executeQuery(Prep aredStatementInPool.java:862)


      P.S. My beans wotk fine on Weblogic6.1/7.0. May be I have bug in jbosscmp-jdbc.xml...