1 Reply Latest reply on May 30, 2002 2:29 PM by prabha

    ORA-00904: invalid column name

    prabha

      Hi,

      I am using JBOSS3.0 RC3, Oracle 8.1.7. I am trying to create a 1-1 mapping between two tables:
      Table name: Key
      Fields: id VARCHAR2(100) (PK)
      name VARCHAR2(100)
      Table name: KMF
      Fields: id VARCHAR2(100) (PK)
      name VARCHAR2(100)
      part_id VARCHAR2(100) Foreign key referencing Key.id

      I could create both key and kmf, if I don't have any relationships defined. I wanted to define the 1-1 relationship between these two tables:

      ejb-jar.xml


      <ejb-relation>
      <ejb-relation-name>KMF-Key</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>KMFhasKey</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>KMF</ejb-name>
      <cmr-field>
      <cmr-field-name>myKey</cmr-field-name>
      </cmr-field>
      </relationship-role-source>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>KeyhasKMF</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>Key</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>

      </ejb-relation>





      jbosscmp-jdbc.xml:


      <ejb-relation>
      <ejb-relation-name>KMF-Key</ejb-relation-name>
      <foreign-key-mapping>
      <entity-relationship-role>
      <ejb-relationship-role-name>KMFhasKey</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>myKey</field-name>
      <column-name>PART_ID</column-name>
      </key-field>
      </key-fields>
      </entity-relationship-role>

      <entity-relationship-role>
      <ejb-relationship-role-name>KeyhasKMF</ejb-relationship-role-name>
      <key-fields>
      </key-fields>
      </entity-relationship-role>

      </foreign-key-mapping>

      </ejb-relation>



      myKey in the above script is a Key which is an EJBObject. After I add these relationships, if I just create a KMF, I see the following error. I tried to create with and without a key. For some reason, I see the same error if I just create a key as well. (except the INSERT statement inserts into Key)

      From log file:
      2002-05-23 15:37:50,034 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.KMF] Executing SQL: INSERT INTO KMF (ID, name, Key_null) VALUES (?, ?, ?)
      2002-05-23 15:37:50,064 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.KMF] Could not create entity
      java.sql.SQLException: ORA-00904: invalid column name

      Has anyone seen this before? Is there something that I am doing wrong?

      Thanks,
      Prabha.