1 Reply Latest reply on Feb 2, 2003 8:06 AM by Stephen Ridley

    Can a cMR field be part of a Primary key?

    Dries De Moor Newbie

      I'm using JBoss 3.0.4 with tomcat 4.1.12.
      I have a question concerning CMR.

      I have 2 beans, A and B
      Bean A has 2 CMP fields ID (is PK) and name.
      Bean B has 2 CMP fields sequenceNumber and a description.
      The field which links bean B and A is the ID of Bean A.

      I define a primary key class for bean B which is based on the field sequenceNumber and the ID refering Bean A.

      I tried this but I can't get it up and runnning.
      Because Bean B is related to Bean A I have to call the CMR method in the ejbPostCreate of Bean B.
      The ejbCreate method returns the primary key. But at that moment the CMR method is not called. So I get a nullpointer at the moment JBoss want to return the PK.

      Is it possible to let a CMR field be part of a Primary key class? If it is, how can I do this? ( some extra coding is needed, or do I have to add some tags in the descriptor files?


      Thanks a lot


      Dries

        • 1. Re: Can a cMR field be part of a Primary key?
          Stephen Ridley Newbie

          Hi Dries,

          I posted a similar question a day or so ago and this is a question that has been asked many times. As far as I am aware, only JBOSS 3.2.0RC1 allows your managed CMR field to be part of a primary key. I have so far not quite been able to get this working as I am unsure exactly if my jbosscmp and ejb-jar.xml files are correct. What I need really is a working example.

          If you solve this problem please post back, as I shall vice-versa.

          Regards,
          Stephen.