Justin, That's a little bit tricky since it involves some advanced mapping capabilities from a vendor's CMP engine. It also falls outside the realm of the EJB 2.0 specification (how convenient!), since the spec does not define how an abstract schema maps to an underlying persistent store. Or to be specific in this case - how an abstract schema maps to (potentially) multiple tables in an RDBMS.
You're basically looking for a feature that allows an entity bean's fields to map to multiple tables. Some AppServer vendors do provide such a feature in their CMP 2.0 engines (atleast we do), but the caveat here is that such a feature is vendor specific. In Borland Enterprise Server's case, we provide the feature by: (a) Allowing an entity bean to map to columns in multiple tables. (b) Allowing the developer to override EJB-QL generated by the CMP engine with your own SQL (which in this case would provide the JOIN over the cross reference table and select not only the columns from the Artist table, but also the 'sequenceNumber' column from the cross reference table. If portability among AppServer vendors is a concern, then the other options are to use straight forward JDBC (say from a session bean or DAO) or resort to BMP. A less elegant approach (which I dislike - personally) is to create an entity bean that maps to your cross reference table. In case you're interested in how our CMP engine provides the above mentioned features, here are a couple of links: http://info.borland.com/techpubs/bes/entity_persistence20.html http://info.borland.com/techpubs/bes/ejb-ql.html -krish Borland > -----Original Message----- > From: A mailing list for Enterprise JavaBeans development > [mailto:[EMAIL PROTECTED]] On Behalf Of Justin Wesbrooks > Sent: 02 January 2003 18:03 > To: [EMAIL PROTECTED] > Subject: How to add an extra field with M:N relationship in CMR > > > I have 2 tables with a M:N relationship and a bridge table > that joins the > two. > > Product Table Bridge Table Artist Table > > UPC UPC ARTISTID > TITLE Artist ID ARTISTNAME > ETC.... Sequence Number ETC... > > The "Sequence Number" field is used to determine the sequence > that artists > appear on the physical piece of product. When I use CMR's, I need to > include > "sequence number" in my ArtistEJB which is contained in a > collection in the > ProductEJB. > > Are there any examples of this? I tried searching Google but > couldn't find > anything. > > ============================================================== > ============= > To unsubscribe, send email to [EMAIL PROTECTED] and > include in the body > of the message "signoff EJB-INTEREST". For general help, > send email to > [EMAIL PROTECTED] and include in the body of the message "help". > > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".