From: Jason E. <jasone@GreenRiverComputing.com> - 2003-06-06 17:28:03
|
So, two things AlertBean: ========= /** * Get all Contact's for this alert. * * @ejb.interface-method * * @ejb.relation * name="Alert-Contact" * role-name="alerts-have-many-contacts" this is a bi-directional relationship, so leave out the target stuff, xdoclet will figure it out on its own * * @ejb.relation-table * table-name="alert_contacts_rel" * create-table="false" * remove-table="false" * * @jboss.relation * related-pk-field="contactId" * fk-column="contact_id" * fk-constraint="false" * * @jboss.relation-mapping * style="relation-table" * * @ejb.value-object * aggregate="com.baselogic.yoursos.contact.ContactDto" * aggregate-name="Contact" * match="normal" * members="com.baselogic.yoursos.contact.ContactLocal" * members-name="Contact" * type="Collection" * relation="external" */ public abstract Collection getContacts(); public abstract void setContacts( Collection pContacts ); ContactBean: =========== /** * Get the User for this Contact * * @ejb.interface-method * * @ejb.relation * name="Alert-Contact" * role-name="contact-belongs_to-many-alerts" other side of the relationship, no target-xxx properties should be here either. * * @ejb.relation-table * table-name="alert_contacts_rel" * create-table="false" * remove-table="false" * * @jboss.relation * related-pk-field="alertId" * fk-column="alert_id" * fk-constraint="false" * * @jboss.relation-mapping * style="relation-table" **/ this getter should be a Collection too public abstract Collection getAlert(); public abstract void setAlert( Collection pAlerts ); -jason On Friday, June 6, 2003, at 05:41 AM, Mick Knutson wrote: > I made sure the changes where what you mentioned. The randomness seems > to be gone, but each Contact can only be associated with one (1) Alert > still. > Here is the relevant code as per your email: > > AlertBean: > ========= > /** > * Get all Contact's for this alert. > * > * @ejb.interface-method > * > * @ejb.relation > * name="Alert-Contact" > * role-name="alerts-have-many-contacts" > * target-ejb="Contact" > * target-role-name="contact-belongs_to-many-alerts" > * --target-multiple="yes" > * > * @ejb.relation-table > * table-name="alert_contacts_rel" > * create-table="false" > * remove-table="false" > * > * @jboss.relation > * related-pk-field="contactId" > * fk-column="contact_id" > * fk-constraint="false" > * > * @jboss.relation-mapping > * style="relation-table" > * > * @ejb.value-object > * aggregate="com.baselogic.yoursos.contact.ContactDto" > * aggregate-name="Contact" > * match="normal" > * members="com.baselogic.yoursos.contact.ContactLocal" > * members-name="Contact" > * type="Collection" > * relation="external" > */ > public abstract Collection getContacts(); > public abstract void setContacts( Collection pContacts ); > > > ContactBean: > =========== > /** > * Get the User for this Contact > * > * @ejb.interface-method > * > * @ejb.relation > * name="Alert-Contact" > * role-name="contact-belongs_to-many-alerts" > * target-ejb="Alert" > * target-role-name="alerts-have-many-contacts" > * --target-multiple="yes" > * > * @ejb.relation-table > * table-name="alert_contacts_rel" > * create-table="false" > * remove-table="false" > * > * @jboss.relation > * related-pk-field="alertId" > * fk-column="alert_id" > * fk-constraint="false" > * > * @jboss.relation-mapping > * style="relation-table" > **/ > public abstract AlertLocal getAlert(); > public abstract void setAlert( Collection pAlerts ); > > > Thanks in advance for your help.... > |