Appendix C. EJBGen code and templates

In this appendix, we describe all of the code and templates for the EJBGen generator. We show the output using the example definition files in the EJBGen case study (chapter 10, section 10.5). You can find code that is not included here on the book’s web site (

C.1. The generator code

The next three sections examine the code for the EJBGen generator.

C.1.1. ejbgenRead.rb

The file in listing C.1 contains the code for reading the three input files: schema, extensions, and samples. The schema file contains XML that describes all of the tables and their relationships. The extensions file includes any extra data transfer object, query, or custom method definitions. As you’d expect, ...

Get Code Generation in Action 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.