Hello,

I am somewhat new to EJB and entity beans.  I am trying to write the tags
for my relationships.  I have tables with compound primary keys.  One
question I have is about the primkey-field of @ejb.bean.  How do we handle
the situation where we have compound primary keys in our tables?  I have put
@ejb.pk-field on all my persistent fields that are primary keys, and my
PrimaryKey classes are being generated correctly, but how do we handle them
in terms of relationship mapping?  I am getting the following error when
JBOSS starts up:

org.jboss.deployment.DeploymentException: At least one role of a foreign-key
mapped relationship must have key fields (or <primkey-field> is missing from
ejb-jar.xml): ejb-relation-name=participant-service-history

I have some example code below.

Thank you in advance.

Peter

/**
 * @author pwileycordone
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 *
 * @ejb.bean
 *    name = "Participant"
 *    display-name = "Participant Entity Bean"
 *    description = "Participant CMP Entity Bean"
 *    view-type = "local"
 *    type = "CMP"
 *    cmp-version="2.x"
 *
 * @ejb.transaction
 *    type = "Required"
 *
 * @ejb.pk
 *
 * @ejb.value-object
 *    match = "light"
 *    name="ParticipantLight"
 *
 * @ejb.value-object
 *    name = "Participant"
 *    match = "*"
 *
 * @ejb.persistence table-name="employee"
 *
 * @jboss.datasource="ACGDB"
 * @jboss.create-table "false"
 * @jboss.remove-table "false"
 * @jboss.tuned-updates "true"
 * @jboss.read-only "false"
 * @jboss.time-out "100"
 */
public abstract class ParticipantBOEJB implements EntityBean
{

...

  /**
   * @ejb.interface-method
   *
   * @ejb.relation
   *     name="participant-service-history"
   *     role-name="participant-has-service-history"
   *
   * @ejb.value-object
   *     aggregate="com.divinvest.dbol.valueobject.ServiceVO"
   *     aggregate-name="Service"
   *     members="com.divinvest.dbol.ejb.ServiceLocal"
   *     members-name="ServiceHistory"
   *     relation="external"
   *     type="java.util.Set"
   */
  public abstract Set getServiceHistory();

  /** @ejb.interface-method */
  public abstract void setServiceHistory(Set entries);

...

And here is some code from the service class

/**
 * @author pwileycordone
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 *
 * @ejb.bean
 *    name = "Service"
 *    display-name = "Service Entity Bean"
 *    description = "Service CMP Entity Bean"
 *    view-type = "local"
 *    type = "CMP"
 *    cmp-version="2.x"
 *
 * @ejb.transaction
 *    type = "Required"
 *
 * @ejb.value-object
 *    name = "Service"
 *    match = "*"
 *
 * @ejb.persistence table-name="service"
 *
 * @jboss.datasource="ACGDB"
 * @jboss.create-table "false"
 * @jboss.remove-table "false"
 * @jboss.tuned-updates "true"
 * @jboss.read-only "false"
 * @jboss.time-out "100"
 */
public abstract class ServiceBOEJB implements EntityBean
{
...

  /**
   * @ejb.interface-method
   *
   * @ejb.relation
   *     name="participant-service-history"
   *     role-name="service-belongs-to-participant"
   *     cascade-delete="yes"
   */
  public abstract ParticipantLocal getParticipant();

  /** @ejb.interface-method */
  public abstract void setParticipant(ParticipantLocal value);
}

Peter N. Wiley-Cordone
Internet/System Developer
Diversified Actuarial Services Inc.
275 Grove Street
Suite 2-300
Newton, MA 02466
Phone  (617) 663-1225
Fax (617) 559-0498
[EMAIL PROTECTED]


-----------------------------------------
CONFIDENTIALITY NOTICE
----------------------
This transmission is intended for the sole use of the individual
and/or entity to whom it is addressed, and may contain information
and/or attachments that are privileged, confidential and exempt from
disclosure under applicable law.  If the reader of this transmission
is not the intended recipient, you are hereby notified that any
disclosure, dissemination, distribution, duplication or the taking of
any action in reliance on the contents of this transmission by someone
other than the intended addressee or its designated agent is strictly
prohibited.  If your receipt of this transmission is in error, please
notify the sender by replying immediately to this transmission and
destroy the transmission.  Thank you.
(DMZIM01)



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to