13.3. Keep Domain Classes Separate from Others

As outlined in Chapter 12, persistent-domain classes and business-logic classes using them can technically be compiled separately, with only the persistent classes being subsequently enhanced.

The easiest way to practically achieve this is to keep two separate source directories for the two types of classes. This approach is not technically required, because it would be perfectly possible to simply compile and enhance all classes of a project, but it has several potential benefits, including the following:

  • Increased build speed (even a well-written fast byte-code enhancer takes time on a large project when unnecessarily enhancing hundreds of persistent-aware classes that would not have to be enhanced; ...

Get Core Java™ Data Objects 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.