Best Practices

It is preferable to implement relationships between entity beans using container-managed persistence as opposed to bean-managed persistence for the following reasons:

  • The code is simpler to write. With BMP, you need to write code to manage relationships. With CMP, you need to declare how the relationships are managed in the deployment descriptor. The container generates all the relationship code.

  • The container automatically handles referential integrity. For example, in a one-to-one relationship, if you change one side of the relationship, the container automatically drops the old relationship and replaces it with the newly formed one-to-one relationship.

  • Containers typically provide performance optimizations, such as optimizing the SQL to load the entity bean and its relationships.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.233.43