12.3. Example: a directory-server mapping EJB

In keeping with the spirit of EJB 2.0, which says that entity EJBs that map to databases are best handled by CMP, this article demonstrates the use of an entity EJB to represent personal data in a directory server. It’s a serious example, with about 1,200 lines of code, only snippets of which will be presented here. Full source code is available, as always, on the book Web site www.kevinboone.com/ejb_book.

This example demonstrates the following features of entity EJB design.

  • The use of ‘home methods’ to handle ‘class level’ entity operations (i.e., operations carried out on no particular instance).

  • The use of a DAO with an abstract method schema to decouple EJB operations from the data store.

  • Implementation ...

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.