is it necessary to have one entity bean for one table in the database?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Banda_Srinivas
Posted On:   Thursday, April 5, 2001 09:02 PM

is it necessary to have one entity bean for one table in the database? or can we have one entity bean for multiple tables ? if we have one entity bean for multiple tables, can we do all dml operations (insert/update/delete) on that entity bean ? please clarify with clear explaination. thank you - Srinivas

Re: is it necessary to have one entity bean for one table in the database?

Posted By:   Madani_Benghia  
Posted On:   Sunday, April 8, 2001 01:49 AM

Yes ,you can have one entity bean for multiple tables.However,I do not think you can map one variable in your CMP EJB to two (or more) fields from different tables because one entity bean represent a row of data in a table.

Re: is it necessary to have one entity bean for one table in the database?

Posted By:   AlessandroA_Garbagnati  
Posted On:   Friday, April 6, 2001 08:22 AM

Srinivas,

Yes, you can associate multiple table in a database with a single entity bean, but you will not be able to use the CMP (Container-Managed Persistence), but you will need to use BMP (Bean-Managed Persistence): you have to handle the entire lifecycle of your bean.

In the new specs (EJB 2.0) that are not yet formalized officially, the CMP will be able to manage relationships between table, helping, probably, cases like yours.
About | Sitemap | Contact