2 Replies Latest reply on Oct 14, 2004 2:09 PM by Tom Clifford

    How best to model Entity Bean associations with EJBs of the

    Jason Cunningham Newbie

      Hi all,

      To illustrate the question, lets work with a 'News' Entity bean which contains info related to a single News Article (ie. Headline, Author, etc). This can be modelled very simply with CMP as the data is all in one table.

      However, if each News Article can have a number of related News Articles, I'm not sure how best to implement it. Obviously, we'll need another table to store the relationships. Options I can think of are:

      1) Create a new Entity called 'News_Relationship' which stores data on a single mapping. Then use CMR to model the one-to-many relationship - but there could be thousands of these tiny beans (maybe this is a good thing!)

      2) Use BMP - simply have a second 'select' statement in my ejbLoad method that popluates an array containing the relationships. But you'd loose all the benefits of CMP which seems wrong to me.

      Any body have any comments or other options?

      Thanks,

      Jason