[jboss-dev-forums] [Javassist development Forum] - Little Help with CMP Entity Bean

dani-cas do-not-reply at jboss.com
Mon Nov 20 17:17:42 EST 2006


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987428#3987428

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987428



More information about the jboss-dev-forums mailing list