Correction in that last email.  It should read:
"Otherwise, it's a one-to-many relationship, not a many-to-many relationship."

- Adam

> -----Original Message-----
> From: Adam Houghton [mailto:[EMAIL PROTECTED] 
> Sent: Friday, June 06, 2003 12:26 PM
> To: [EMAIL PROTECTED]
> Subject: RE: AW: [Xdoclet-user] updating a m-m value object?
> 
> 
> The code from you earlier email:
> public abstract AlertLocal getAlert();
> public abstract void setAlert( Collection pAlerts );
> 
> This code should be:
> public abstract Collection getAlerts();
> public abstract void setAlerts( Collection pAlerts );
> 
> The getAlerts() needs to return a Collection object, not an 
> AlertLocal object.  Otherwise, it's a one-to-one 
> relationship, not a one-to-many.
> 
> Also, if you're making it a bi-directional relationship (both 
> beans know about each other), you do not need any of the 
> "target-..." tags.  Those are only for unidirectional 
> relationships where one side of the relationship doesn't know 
> about the other.
> 
> - Adam
> 
> > -----Original Message-----
> > From: Mick Knutson [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 06, 2003 12:12 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: AW: [Xdoclet-user] updating a m-m value object?
> > 
> > 
> > Understood, but the Collection of Contacts in the AlertBean, and the
> > Collection of Alerts in the ContactBean should be just that. 
> > Right? How is my code below _not_ doing what you said?
> > 
> > 
> > ---
> > Thanks...
> > Mick Knutson
> > ---
> > 
> > 
> > 
> > 
> > 
> > >From: "Adam Houghton" <[EMAIL PROTECTED]>
> > >Reply-To: [EMAIL PROTECTED]
> > >To: <[EMAIL PROTECTED]>
> > >Subject: RE: AW: [Xdoclet-user] updating a m-m value object?
> > >Date: Fri, 6 Jun 2003 09:27:13 -0400
> > >
> > >You're exactly right.  That's a one-to-many relationship, not a 
> > >many-to-many relationship.  You need Collections on both
> > sides of the
> > >relationship if you want a bi-directional many-to-many 
> relationship.
> > >
> > >Check out chapter 7 of the O'Reilly EJB book if you want a good
> > >refresher
> > >course on CMR.
> > >
> > >- Adam
> > >
> > > > -----Original Message-----
> > > > From: Eivind Waaler [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, June 06, 2003 8:00 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: AW: [Xdoclet-user] updating a m-m value object?
> > > >
> > > >
> > > > 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
> > > >
> > >
> > >
> > >-------------------------------------------------------
> > >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
> 


-------------------------------------------------------
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