Hi everybody,
this is just a general question on design.
I'm working with a very small example implementation at the moment. My data structure consists of 7 tables. Each of them is mapped to a EntityBean with Container Managed Persistence (CMP & CMR).
I use a stateless SessionBean as a Facade for the data access.
Is there another way to map database tables to beans ?? If I have a database structure which consists of maybe 100 tables: Do I have to map every table to an Entity Bean, if I'd need to access data from each and every table.
Any best practices for EnterpriseBean-Design ?? Any restrictions with Container Managed Persistence ??
cheers
matt
-
Enterprise Application Design (3 messages)
- Posted by: Matthias Zint
- Posted on: July 08 2004 10:09 EDT
Threaded Messages (3)
- Enterprise Application Design by Race Condition on July 08 2004 11:13 EDT
- Enterprise Application Design by Roger Chung-Wee on July 08 2004 15:09 EDT
- Enterprise Application Design by Tim Hague on July 09 2004 05:47 EDT
-
Enterprise Application Design[ Go to top ]
- Posted by: Race Condition
- Posted on: July 08 2004 11:13 EDT
- in response to Matthias Zint
Do a search for 'CMP' or 'Entity Bean' on this site and you will find that most developers avoid entity beans, especially CMP. -
Enterprise Application Design[ Go to top ]
- Posted by: Roger Chung-Wee
- Posted on: July 08 2004 15:09 EDT
- in response to Matthias Zint
-
Enterprise Application Design[ Go to top ]
- Posted by: Tim Hague
- Posted on: July 09 2004 05:47 EDT
- in response to Matthias Zint
You could use a couple of nice J2EE patterns to help out.
The Composite Entity pattern recommends using a few, coarse grained Entity beans rather than lots of little ones. You might have fun using CMP with this though. I would recommend using the Data Access Objects DAO pattern with this - have a Composite Entity manage mutiple DAO's.
You will find that CMP generally doesn't scale that well.
To remove the drudgery from coding lots of database access code I would recommend using a generation tool - either Middlegen (http://boss.bekk.no/boss/middlegen/) for CMP or Torque (http://db.apache.org/torque/) wrapped by your DAO's.
Hope this helps!