Looks to me as if you're not defining the relationship as many to many:

>       public abstract AlertLocal getAlert();
>       public abstract void setAlert( Collection pAlerts );

Should not these be:

public abstract Collection getAlerts();
public abstract void setAlerts(Collection pAlerts);

Or am I totally wrong here?

Regards
.eivind

On Fri, 6 Jun 2003, 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....
> 
> 
> 
> ---
> Thanks...
> Mick Knutson
> ---
> 
> 
> 
> 
> 
> >From: "Ingo Bruell" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: AW: [Xdoclet-user] updating a m-m value object?
> >Date: Fri, 6 Jun 2003 11:14:10 +0200
> >
> >-----BEGIN PGP SIGNED MESSAGE-----
> >Hash: SHA1
> >
> >Hi,
> >
> > > When I then edit AlertB and select ContactA and ContactB in the 
> >multi-select
> > > form element, I get the 2 rows that _were_ created for AlertA, and 
> >replace
> > > them with a row for ContactA and ContactB associating to AlertB. So 
> >AlertA
> > > does not have any Contacts associated with it anymore.
> > > So, it seems that I can only have a given Contact, associated with one 
> >(1)
> > > Alert at a time. Not multiple. But I have target-multiple="true" set for 
> >the
> > > get/set Contact method on the AlertBean.
> >
> >It looks like you have not defined a m:n relation. Both sides must have a
> >relation of type Collection. So there is no need to set 
> >target-multiply="yes".
> >The setter Methode also needs a parameter of type Collection
> >
> >
> >best regards
> >
> >Ingo Bruell
> >
> >- - ---
> ><[EMAIL PROTECTED]>
> ><ICQ# 40377720>
> >Oldenburg  PGP-Fingerprint: CB01 AE12 B359 87C4 BF1C  953C 8FE7 C648 169E 
> >E5FC
> >Germany    PGP-Public-Key available at pgpkeys.mit.edu
> >
> >-----BEGIN PGP SIGNATURE-----
> >Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>
> >
> >iQA/AwUBPuBNTo/nxkgWnuX8EQJDwwCcCSev3HEMO9aWeyD/ZInwHgc+/fgAnRd9
> >uS4DtjuI5Y+zgZhiwSGllwF/
> >=JR4R
> >-----END PGP SIGNATURE-----
> >
> >
> >
> >
> >-------------------------------------------------------
> >This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
> >thread debugger on the planet. Designed with thread debugging features
> >you've never dreamed of, try TotalView 6 free at www.etnus.com.
> >_______________________________________________
> >xdoclet-user mailing list
> >[EMAIL PROTECTED]
> >https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> 
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*  
> http://join.msn.com/?page=features/junkmail
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
> _______________________________________________
> xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> 



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to