Is CMR Recommended for Static Data

Discussions

EJB programming & troubleshooting: Is CMR Recommended for Static Data

  1. Is CMR Recommended for Static Data (1 messages)

    Hi

    As in most applications, I have quite a large amount of static data. I have used EJB's to model these behind a Session Facade.

    However, I am wondering if it is recommended/necessary to create CMR relationships to these beans from other domain-based beans.

    Why can't I just represent my relationship via a straight forward attribute (which would be the primary key for my static data bean). I have not really found any discussion around this in the EJB Design Patterns book.

    Comments here would be very helpful to me.

    Regards

    Chris
  2. Hi Chris,
    I'm a bit behind the times re CMR, but I would have thought that there's no requirement to set up CMR's to these static objects unless you are engaging them as composites (i.e. defining new persistent objects comprising a composite of the simpler ones). Obviously I don't know your application, but you seem to be describing a simple scenario where setting up the CMR's would be un unnecessary overhead.

    It seems as if you could just use simple attributes as you say.

    Remember to point of setting up CMRs is to be able to delegate the persistence of objects with complex relationships to the container. Do you really have persistent complex relationships? If you do, then CMR is what you need. If you don't, then you can carry on with your attributes.

    It seems to me that because your static data is static, it can't be influenced by changes in other tables, so doesn't need to be involved in a CMR.