When would I choose entity beans (CMP or BMP) over JDO? Java Data Objects (JDO) deals with persisting an object model and its data. The persistence implementation is separated from the actual data interface. This allows a developer to design and implement an object's logic and data-storage logic separately. JDO is designed to be work in different tiers of a distributed system. JDO is a lightweight persistence mechanism that adds little...
or no additional compile-time code.
Entity beans, on the other hand, are heavyweight, application server-specific components designed to be used in the data-tier of a distributed system. The EJB specification defines a framework that removes a lot of the redundant infrastructure worries, e.g. lifecycle management, away from the developer. However, this forces an entity bean developer to become involved in working with multiple interfaces, a deployment descriptor and the EJB framework itself. A developer must also test an entity bean in the environment that it will be deployed in.
JDO can actually be used by an EJB container provider as the implementation for container-managed persistence (CMP). Likewise, JDO can be used by a developer as the implementation for bean-managed persistence (BMP).
The decision to work with entity beans vs JDO is most likely determined by the amount of complexity embodied within a data resource and by the experience level of a particular development staff. Also, if an application or system is designed on top of the data tier, entity beans might provide a simple means to bridge the gap between data and business logic. If the application or system is designed on top of a services/business-logic tier, JDO might prove more appropriate.
Dig Deeper on Java Web Services
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.