1 Reply Latest reply on Nov 21, 2006 1:55 PM by Roy Crosland

    Little Help with CMP Entity Bean

    Daniel Castro Newbie

      I have the following error, what should have been very simple turned put to be very complicated:

      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: jboss.j2ee:service=EjbModule,module=SISEPROEJB.jar
       State: FAILED
       Reason: org.jboss.deployment.DeploymentException: Atleast one role of a
      foreign-key mapped relationship must have key fields (or <primkey-field> is
      missing from ejb-jar.xml): ejb-relation-name=Abogado-to-Admninistrativo
      

      I have two entity beans called abogado and adminsitrativo, the relation is abogado-has-many-adminitrativo, (one-to-many)
      Here is my xdoclet code in abogado:
       /**
       * @ejb.interface-method
       * @ejb.relation
       * name="Abogado-to-Administrativo"
       * role-name="Abogado-has-many-Administrativo"
       * target-ejb = "Administrativo"
       * target-role-name = "Administrativo-has-one-Abogado"
       * @jboss.target-relation related-pk-field = "userName"
       * fk-column = "UserName_id_fk"
       * @return Collection de procesos administrativos
       */
       public abstract Collection getProcesos();
      


      Here is the xdoclet code for administrativo
       /**
       * @ejb.interface-method
       *
       * @ejb.relation name="Abogado-to-Admninistrativo"
       * role-name="Administrativo-has-one-Abogado"
       * target-ejb="Abogado"
       * target-role-name="Abogado-has-many-Administrativo"
       * target-multiple="true"
       *
       * @return
       */
       public abstract AbogadoLocal getAbogado();
      


      Both beans have pk fields defined with:
       * @ejb.persistence column-name = "id"
       * @ejb.pk-field
      

      and
       * @ejb.interface-method
       * @ejb.persistence column-name = "UserName"
       * sql-type="VARCHAR"
       * @ejb.pk-field
      


      Please help me I have been stuck here for the whole weekend.

      Thanks
      Daniel Castro