You don't need BMP to do this, CMP works just fine. Create separate entity beans for Movie, Actor, etc and establish many-to-many relationships between them.
However, I will provide this warning: If you don't already know how to do this, that is, if you haven't already climbed the EJB learning curve, you will be a *lot* happier if you choose some other O/R mapping tool. Torque, Castor, Hibernate, JDO, or even just straight JDBC; with any of these solutions, your project will be up and running long before an entity bean solution, and it will perform a lot better too. Relationships in particular are hopelessly immature in Orion, and they're even painful in WebLogic. Jeff Schnitzer [EMAIL PROTECTED] > -----Original Message----- > From: Chris Nias [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 24, 2002 7:49 AM > To: Orion-Interest > Subject: RE: OffTopic: Entity-Beans and relational structure > > If you get the Java 2 Enterprise Edition Developers Guide (I have v > 1.2.1 pdf) from www.java.sun.com > Then it is on page 135 - Mapping Table Relationships to Entity beans > It goes on to describe when you should use entity beans, and when to use > helper classes (hint: that is what you need!) > It also gives a good example with source code. > Be warned though; you will have to use BMP! > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of Maximilian > Eberl > Sent: 24 April 2002 13:13 > To: Orion-Interest > Subject: OffTopic: Entity-Beans and relational structure > > Excuse me for asking off topic (and stupid), I am just learning to use > Entity Beans on Orion. > > In most tutorials entity beans only represent ONE ROW from ONE TABLE, > but > relational databases go far beyond that. > > I have a relational database for movies, actors, directors & writers. > > So I have a table tblMovies > INT id, VARCHAR title, INT year, VARCHAR description > e.g.: > 1, 'Casablanca',1942,'the classical movie' > 2, 'The Maltese Falcon',1946,'begin of the dark series' > 3, 'The Seawulf',1947,'after the novel from Jack London' > ... > > I have a tblActors (INT id, VARCHAR name) > 1,'Humphrey Bogart' > 2,'Ingrid Bergman' > 3,'Edward G. Robinson' > ... > > and in the same manner tblDirectors, tblWriters > > And I have tables for the relations, e.g. > > tblRoles (INT filmid, INT actorid) > 1,1 > 2,1 > 1,2 > 3,3 > .. > and also tblMisEnScene, tblScreenplay > > meaning: Humphrey Bogart (actorid: 1) appeared in 'Casablanca' (filmid: > 1) > and 'The Maltese Falcon' (filmid: 2), Ingrid Bergman (actorid: 2) > appeared > in 'Casablanca' (filmid: 1), Edward G. Robinson (actorid: 3) appeared in > 'The Seawulf' (filmid: 3) . So this relational structure allows that one > film can have multiple actors, writers, directors and one actor can > appear > in multiple films. Relational basework, of course. > > If I want to extract those films in which Humphrey Bogart appeared I can > do > this easily in SQL (used by a Servlet) with: > > SELECT title FROM tblFilms WHERE id IN (SELECT filmid FROM tblRoles > WHERE > actorid=(SELECT id FROM tblActors WHERE name='Humphrey Bogart')) > > (or as in my case with JOINS from MySQL) > > When I do want to write an EJB-Application using this database, how do I > do > this ? How do I represent the relational data ? > > Do I have to keep Entity Beans for EVERY row of ANY table ? Do I have to > create temporary tables with all information merged ? This creates a > problem > because one film can have one or more writers (Casablanca had three) and > (in > most cases) more than one actor. > > This way ? > > public class MovieBean implements javax.ejb.EntityBean > { > String Title; > String[] Actors; > ... > public String getTitle() throws RemoteException; > {... > } > public String[] getActors() throws RemoteException; > { > return Actors[]; > } > } > > using Arrays filled from the database with all actors, directors, > writers ? > > Please give me a hint ! (Well, I know I am stupid. But it is a good work > to > help stupid persons) > > > Maximilian Eberl > http://www.derdickemax.de > mailto:[EMAIL PROTECTED] > > > >