Blue Elephant Referee Scheduler
Using Hibernate
Intro:
This project uses a tool called Hibernate, which is an object-relationl mapping tool. This tool allows us to write a model layer, which encapsulates the business logic of the application, using Java objects. Hibernate transparently maps these objects into tables in a (MySQL) database. The mappings are xml files, one per Java class.
Motivation:
Hibernate abstacts a large amount of the grunt work associated with persistence. There is no hand-written JDBC code in our application. Hand-writing JDBC code is tedious, error-prone, and time-consuming. Hibernate also provides built-in implementations of other useful design patterns, such as lazy-load, and optimistic locking for concurrency control. Hibernate also provides a layer of abstraction which hides underlying transactional strategies, which in our case is JDBC database transactions. We explain this more thoroughly in the short paper on concurrency and transactions.
Usage:
Our model layer components are located in the model package. This package also contains the mapping files for these objects, which have corresponding filenames, with a .hbm suffix. For example, the Referee type, which is implemented with the class Referee.java, is mapped in the file Referee.hbm.xml.
We take advantage of the following Hibernate features:
Links:
Getting started with Hibernate is pretty painless. The online documentation is quite good, and a comprehensive book, Hibernate in Action, should be published by August 2004. Also check out the following articles and tutorials listed on the Hibernate website.