Hibernate Based Web Service


This is my second pass at a Hibernate project. For this, I'm attempting to:

  • Create a service that returns a HashTable of Route information, a single RouteType per entry.
  • URL contains the tag name.
  • Values returned is an XML representation of the HashTable that can then be used to retrieve individual routes (the key set).

Starting out with a Maven-based project using the codehaus.mojo archetype for webapp.

  • Document the strategy for creating tables and mapping files from Annotated Java classes.
  • Use the inheritance strategy of separate tables per subclass.
  • Use the Route hierarchy as the test bed.
  • classHierarchySample.png
  • Create an archtype that I can re-use in other projects.


  • Decide which fields are mapped to the database (since the EncodedTrack is calculated outside of DB at this time). ''Marking up the BikeTrain class on the first pass.''
  • Generate some DDL from the HBM.


  1. Copied much of the existing bkthn project using the Archetype Creation steps (mvn archtype:create, mvn install, then chose the local archtype when creating the new project)
  2. Copied in the POJO class I wanted to persist
  3. Cleaned up the hibernate.cfg.xml file (including setting the DB connection parameters)
  4. Added Annotations to the POJO class
  5. Added the class to the configuration.
  6. Setup the Eclipse tools to use the configuration: Hibernate Console Configuration
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License