12.2. Optimizing database access

When using BMP, it is the developer’s responsibility to ensure that the EJB is efficient in its access to the database. In general, the container is unable to determine whether a call to ejbLoad() or ejbStore() is really necessary; it will always call ejbLoad() at the start of a transaction and ejbStore() before committing the transaction, but it may call either of these methods at other times if it thinks it might be necessary. Note that it is permissible for the container to passivate an EJB mid-transaction [EJB2.0 10.5.1], which would involve another pair of calls to ejbStore() and ejbLoad(). The entity EJBs described in most textbooks use a naive approach to loading and storing, for reasons of clarity. In ...

Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.