Mapping quick reference (Hibernate)

 

Many Hibernate topics list all possible XML mapping elements and mapping annotations in a topic. The usefulness of doing so is questionable. First, this information is already available in a convenient form; you only need to know how to get it. Second, any reference we might add here would be outdated in a matter of months, maybe even weeks. The core Hibernate mapping strategies don’t change that often, but little details, options, and attributes are always modified in the process of improving Hibernate.

And isn’t the main reason you want a mapping reference—so you have an up-to-date list of all options?

■ You can get a list of all XML mapping elements and attributes bundled with Hibernate in hibernate-mapping-3.0.dtd. Open this file in any text editor, and you’ll see that it’s fully documented and very readable. You can print it out as a quick reference if you work with XML mapping files. If the syntax of the DTD bothers you, do a few quick search/replace operations on a copy of this file to replace the DTD tags with something you prefer in your printed output.

■ You can get a list of all mapping annotations by reading the Javadoc for the javax.persistence and org.hibernate.annotations packages. The Java-doc is bundled with the Hibernate Annotations package. For example, to get a clickable, up-to-date reference for all Hibernate extension annotations, open api/org/hibernate/annotations/package-summary.html.

Next post:

Previous post: