Hi All Say i have a database with 40 tables where in each of them i would be having some manipulation(insert/update/delete) as well querying from the same. In such a scenario how to decide for how many tables do we need to create entity beans Rgrds
Yup, for CMP the correspondence is going to be close. Ignoring other ways of getting data (views, stored procedures), what you'll have is: T = number of tables we want to provide data to/from the application R = number of relationship tables O = number of other tables maintained outside the application (e.g. via triggers) T + R + O = the total number of tables So "T" would be the number of CMP-based entity beans you'll have. The "R" tables are used for maintaining the constraints, and they'll be mentioned in whatever container-specific deployment descriptor or tool you use for specifying your CMR implementation. The "O" tables are just stuff you are required to have but the application may not care about, like automatically maintained audit trails.
Though the specs do not require this, some application servers allow entity beans to span across multiple tables. Based on your business functionality, you could have less number of entity beans. But the drawback of this approach, is that it could make your code non-portable across other app servers that do not support this feature...
subject: how to decide how many entity beans to have