please explain why we using BMP Entitybeans, actually it's coding is very complicated but in CMP Entity bean is very easy to write coding ,please tell me in which contidions we use BMP Entity bean
You can use BMP when the bean models data that is not managed by the container. This could be an external Database, a legacy system, mail, ... Because the container does not know how to access these data, the bean has to provide that functionality.
Because most CMP implmentations are junk except the odd few (CocoBase, TOPLink, Persistence, Gemstone)
1. Only in cases where there is one-to-one mapping between the entity bean and a table in the underlying database, u can make use of a CMP.
2. consider a situation in which u are representing 2 tables in the database as one big EJB on the server side. In this case u've to go for a BMP. the vice-versa also holds.
3. In CMP, for the finder methods, u've to define the queries in the XML deployment descriptor. This is perfectly OK if ur find is simple and straight forward. Suppose, if u want to make a complex find involving many sub-queries and nested queries with some inner-joins. In this case, we can't write a finder query with the Query Language provided by the underlying application server. (in weblogic we use WL-QL). There is no other go except to write the query using normal JDBC. Here also we've to model our bean as a BMP bean.
(ahamed at aztec dot soft dot net)