7.3. Bare Essentials of Hibernate

In this section, I will rapidly and only tersely introduce the features of the Hibernate object/relational mapping and persistence framework. I will not talk about Hibernate-EntityManager, which as a JPA implementation serves to bridge the minor gap in syntax and semantics between JPA and Hibernate.

Hibernate is feature-rich compared to the lightweight JPA, but they share the same core concepts. This is no surprise, as the lead developers of Hibernate created and influenced the JPA specification. In some sense, Hibernate's simplicity and elegance were brought into the Java persistence architecture as a much needed relief to the beleaguered world of the legacy entity beans.

A Hibernate entity is a Plain Old Java Object (POJO) that declares a no-argument constructor. The no-argument constructor allows instantiation of the POJO using reflection. In addition, it's recommended that entities use Java bean–style getter and setter methods for its properties and declare its properties private.

Entities can define metadata using annotations or external XML configuration files. For the most part, Hibernate entity annotations are the same as JPA annotations. They both utilize Java 5 annotations. Hibernate Annotations, which is available as a separate download, maps the Java 5 and JPA annotations to the Hibernate metadata. XML configuration files are more traditional and have existed from the first few versions of Hibernate. By convention, entity metadata ...

Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.