|
|
Entity beans don't usually contain business logic, so they're good candidates for auto-generation. This is just as well, as entity beans tend to contain a lot of code - for example in getter and setter methods. The deployment descriptors for EJB 2.0 CMP entities are also far too complex to hand-author reliably.
Good tool support is vital to productivity if using entity beans. Several types of tools are available, from third parties and application server vendors. For example:
Object modeling tools such as Rational Rose and Together. These use the object-driven modeling approach we discussed in Chapter 7, enabling us to design entities graphically using UML and generate RDBMS tables. This is convenient, but object-driven modeling can create problems.
Tools to generate entity beans from RDBMSs. For example, Persistence PowerTier supports this kind of modeling.
Tools to generate entity bean artifacts from a simpler, easier-to-author, representation. For example, both EJBGen and XDoclet can generate local and home interfaces, J2EE standard and application-server-specific deployment descriptors from special Javadoc tags in an entity bean implementation class. Such simple tools are powerful and extensible, and far preferable to hand-coding.
Important | There is a strong case that entity beans should never be hand authored. One argument in favor of using entity beans is the relatively good level of tool support for entity bean authoring. |
|
|