Discussions

EJB programming & troubleshooting: Compound primary key mapping to foreign keys error.

  1. Compound primary key mapping to foreign keys error. (1 messages)

    Scenario
    The schema of a legacy table has a 3 column primary key. 2 of the columns relate to the FK of table B, and the 3rd key relates to the FK of table C. I have no control over the database design and must map my CMP EJBs as-is.

    The schema is: http://engel.us/ejbmapping/schema.gif

    Problem
    It doesn't appear that JBoss is flexible enough to support my schema. Is JBoss incapable of mapping this relationship? If JBoss can handle it, how do I define the ejb-jar.xml relationships? Perhaps this is a shortcoming of EJB 2.1? When JBoss loads my beans, I get this error:

    Quote:
    EJB
    org.jboss.deployment.DeploymentException: Mappings were not provided for all fie
    lds: unmaped fields=[classIndex] in role=x_CLASS_SYM-cmp20-has-x_MASTER_SYMB
    OL-cmp20

    http://engel.us/ejbmapping/stack_dump.txt

    My table relationships are defined as:

    http://engel.us/ejbmapping/ejb-jar.xml
    http://engel.us/ejbmapping/jbosscmp-jdbc.xml

    Thanks
  2. Isn't the error quite descriptive?
    Compare the CMP fields definitions in ejb-jar.xml vs jbosscmp.xml

    Cheers and happy coding,
    Martin