Ready to Hibernate.
Finally, I'm ready to start working on the Hibernate implementation of the Roller Weblogger backend. I ended up doing a lot more refactoring than I had intended. I told you about how I moved code from the Castor implementation into abstract base classes that can be used by the Hibernate implementation. Now I'll describe the changes that I made in the Roller build and code-generation process.
In the original Roller build process, illustrated in Figure 4 of the article Building a J2EE Weblogger, I used abstract javax.ejb.EntityBean
classes as the meta-data basis for generating code via the XDoclet EJBDoclet task. I was subverting EJBDoclet: using it to generate Data Objects, Struts Forms, and Castor mappings but not using any of it's EJB output.
That worked pretty well, but eventually it became a problem. The generated Data Objects were just dumb data-holders and, over time, we realized that they need to be smarter "business objects." The Data Objects were regenerated on every build and that made it diffucult, if not impossible, to add new methods, new logic, and new collections.
The new Roller build/code-gen process<img src="http://www.rollerweblogger.org/resources/roller/xdoclet-roller-sm.jpg" alt="Diagram of Roller build process">
The new Roller build process, or at least the code-generation part of it, is shown above. We now start with some hand written "Plain Old Java objects" or POJOs. We still have to subvert EJBDoclet because the XDoclet <strutsform>
and <castormapping>
can only exist inside EJBDoclet.
I had to use Matt Raible's patched version of <strutsform>
(from his struts-resume example) because the one in XDoclet 1.2b2 works only if the source class extends javax.ejb.EntityBean
and the new Roller POJO's don't do that. Matt and I consider this to be a bug in EJBDoclet, but I'm not sure the XDoclet guys agree. Maybe Roller should define it's own <strutsform>
that works on any POJO and that inserts validator tags (something Matt also added in his struts-resume example).
The Roller build/code-gen process is still not perfect, but it's "good enough" for me to begin my Hibernate implementation of the Roller Business Tier interfaces. I'll be blogging as I go so stay tuned.
Posted by Alex Hornby on March 02, 2003 at 03:14 PM EST #
Posted by Dave Johnson on March 02, 2003 at 03:17 PM EST #
Posted by Alex Hornby on March 02, 2003 at 03:30 PM EST #
Posted by Dave Johnson on March 02, 2003 at 04:12 PM EST #
Posted by Herve Tchepannou on March 03, 2003 at 06:49 PM EST #
Posted by Ken Pelletier on November 15, 2003 at 09:10 PM EST #
Posted by Albert on January 08, 2008 at 08:56 PM EST #