JPOX
JPOX
 Project  |  Ver 1.1  |  Ver 1.2  |  JDO  |  JPA  |  Guides
1.1 | Preparation | O/R Mapping | Runtime | Extensions | Developer
Persistence
Object Identity
Third Party Tools
Teneo : from UML/XML Schema to Relational Persistence, Persisting Eclipse EMF using JPOX

Teneo is a database persistency solution for EMF using JPOX/JDO 2.0. Teneo combines the power of the EMF modeling and code generation framework and the power of storage, caching and querying of sophisticated object-relational mapping software such as JPOX.

Teneo allows you to start with your model (UML or XML Schema) and automatically generate the java source code and relational mappings. Teneo takes over much (or even all) of the manual work of creating relational mapping schemes.

The EMF - JPOX Persistency solution consists of two main tools:

  1. EMF - JPOX OR Mapper: generates object-relational mapping files from the EMF model.
  2. EMF - JPOX Runtime: takes care of handling EMF specific things such as EMF collections, containment and bi-directional relations.
Generate OR Mapping file

First an EMF model has to be prepared and java source code generated using EMF. The next step is to generate the package.jdo file. The package.jdo file describes for a object relational mapping tool how to persist java objects to relational tables. The package.jdo file can be generated within Eclipse by right-clicking a EMF model (ecore) file and selecting the relevant menu item.

Runtime Layer

EMF objects require specific handling in relation to JPOX. This is mainly related to the way EMF handles references and collections. Also the EMF resource approach requires specific JPOX implementations. To handle the EMF specifics, the EMF - JPOX runtime layer was developed. This layer is small (about 150kb) but is essential to get a working EMF - JPOX integration.

The main visible component of the runtime layer is the JpoxDataStore. The JpoxDataStore controls a PersistenceManagerFactory and a set of EPackages which are persisted using the PersistenceManagers of this PersistenceManagerFactory. When using a PersistenceManager, behind the scenes Teneo takes care of instantiating EMF objects and setting/getting EFeatures from the database. Teneo also handles lazy loading of ELists.

JPA/EJB3 Annotations

Teneo will automatically map the EMF model to an object relational representation. However there are situations in which it makes sense to influence or control the mapping. For this purpose Teneo supports JPA annotations in the model. The annotations can be used to control the way the inheritance structure is mapped to the relational store or how efeatures are mapped to database columns. Annotations can be specified directly in your model definition or defined separately in a xml file.

The JPA support has been developed in such a way that it is only required to specify annotations for those parts of the model for which the automatic mapping logic does not result in the required behavior. For example it is possible to specify a column annotation for one efeature in a model while all other efeatures and eclasses are automatically handled by Teneo.

Support and information

Teneo is a project hosted within EMFT at eclipse.org.

Teneo can be downloaded here.

Tutorials and documentation can be found here.

Support is given through the EMFT newsgroup: news://news.eclipse.org/eclipse.technology.emft.

Disclaimer : JPOX does not provide support for nor endorse the use of Teneo. We simply provide visibility of its existence and potential benefits for your organisation.