0 Replies Latest reply on Aug 21, 2002 5:45 PM by mandar

    CMR and Foreign Keys ??

    mandar Newbie

      Hi,
      I am using JBoss 3.0.0 with Tomcat 4.0.3

      I have 2 tables and shown below and I need to create 2 entity beans having CMR.

      Table 1
      SystemInfo (SystemID(PK), SystemName)

      Table 2
      SystemData(SystemID,SubSystemName,SubSystemLocation)
      PK (SystemID, SubSystemName)
      FK (SystemID) maps to SystemID in SystemInfo table.

      Is this possible using CMR ?
      Can one field be in CMR as well as CMP fields sections ?

      I am able to deploy CMR based beans if the dependent field is non primary key and is not in CMP fields section. This means that it will be additional field in child table.

      I also tried to change the primary key of child table
      as
      PK (SystemID)
      and then put the SystemID field in both CMP field and CMR section. I always get "duplicate column name" error.
      In case 2 (with single PK) I turned on the trace and the SQL generated is

      "create table systemdata (systemid varchar2(128), subsystemname varchar2(128), subsystemlocation varchar2(128), systemid varchar2(128))" and constraints

      Any ideas on what I am doing wrong ?

      Thanks
      Mandar