0 Replies Latest reply on Mar 21, 2002 6:21 AM by ObjectWiz

    Self-Referential EJB

    ObjectWiz Newbie

      Hi all,

      I have a question about creating a Self-Referential EJB.

      Basically I wanted to create a Message bean where the message can have child messages (and therefore can also have one parent message). So I want a 1-n relation but of course the catch is, both sides are Message beans.

      I've written the Bean class and (using xdoclet) generated files for Orion and JBoss from the same Bean class. Orion deploys the EAR fine, but JBoss throws the error:

      nested throwable is: org.jboss.deployment.DeploymentException: Atleast one role of a foreign-key mapped relationship must have key fields: ejb-relation-name=parent

      Now this implies a chicken and egg situation... I need to have a parent to use to create a message but I can't create one without assigning a parent... :-D

      Is it possible to create a CMP self-referential bean in this manor?