HomeEMF HibernateEMF JDO/JPOXWeb App GenerationServices
 

Tutorial: Using Hibernate in the EMF Editor

This tutorial describes how the Hibernate EMF resource can be used in the Library editor. This tutorial assumes that you have done the EMF library tutorial.

There are two ways to start the Library editor example:

  1. Using the model wizard created by EMF
  2. Make use of the resource utility provided by Teneo

This tutorial primarily describes the first approach. To start the editor using the resource utility then a small part in this tutorial should be omitted (changing the start method, see next step in this tutorial).

To enable Hibernate support for the Library Editor a small 'bug' in generated editor code has to be repaired: the generated editor allows the creation of invalid objects, e.g. a Library with an empty name. Hibernate integration is more precise and will not allow this.

This tutorial shows a 'quick-and-dirty' method to let the Library example work with Hibernate. The chosen approach is to make very small changes to the generated code and is not focused on an elegant or optimal solution.

The tutorial Library projects can be downloaded from cvs at the following location: host: dev.eclipse.org, root: /cvsroot/modeling, module: org.eclipse.emf/org.eclipse.emf.teneo/examples/library (emf 2.3). The changes in these projects correspond to the changes described here. The Library project has a dependency on a Hibernate Libraries plugin which contains all the hibernate libraries. The hibernate libraries plugin is not present in cvs because of licensing reasons, so you should create your own and set the correct dependency in the Library project (set re-export to true! and set the Eclipse-Buddypolicy in the hibernate libraries plugin).

The next step of this tutorial describes these changes in more detail.