What about "composite entity" pattern... got some questions


EJB programming & troubleshooting: What about "composite entity" pattern... got some questions

  1. I'm building an e-commerce app, got a few tables (around 35). Is it worth using composite entity design pattern or make it simple and use a one CMP (or BMP) for each table???
  2. I hate to say this but ... it depends.

    As a general rule, I try to keep this so that their is a one-to-one mapping between entities and tables (omitting join tables, of course).

    In some cases though, particularly where the database is heavily normalized, this is not practical. If tables are small enough that they don't really make sense as a single business concept, I will use "larger" CMP that aggregate data from several tables. I try to make this the exception, rather than the rule.