Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Teneo/Hibernate/Dynamic EMF Tutorial

< Teneo‎ | Hibernate
Revision as of 04:17, 3 March 2010 by Mtaal.springsite.com (Talk | contribs) (New page: __TOC__ EMF allows you to dynamically change the in-memory ecore model by adding EPackages, EClasses and EStructuralFeatures. Teneo supports persisting dynamically created models. It is f...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

EMF allows you to dynamically change the in-memory ecore model by adding EPackages, EClasses and EStructuralFeatures. Teneo supports persisting dynamically created models. It is for example possible to read an ecore model from an ecore file (without generating code) and create the relational database schema. There are however some (practical) limitations, see the last section on this page.

The source code of this tutorial is available in the example project which you can download here.

This tutorial assumes some basic knowledge of EMF. If you are new to EMF then it can make sense to first try one of the core EMF tutorials which you can find here.

Before starting this tutorial

Before starting this tutorial there are a number of things which you need to take into account:

  • It uses the QuickStart tutorial class described in the quick start tutorial to create a database for the Library example and some content.
  • The initial setup of the quick start tutorial also applies here.
  • The tutorial assumes that there is an empty database with the name DynamicLibrary. When you rerun this tutorial you should make sure that this database is empty again (otherwise one of the smaller tests in the tutorial will fail).
  • In this tutorial the Library example is extended with two new types: SchoolBook (which inherits from Book) and Course which refers to a SchoolBook.

Limitations

  • It is not possible to create a containment relation between a dynamic model and a static model part. With static we mean the model for which java code has been generated.
  • When the model is dynamically changed it is required to update the database schema. To change the database schema database servers can lock the whole database. This is probably not practical in a live production environment.
  • A dynamic EClass can not have a composite-id.

Back to the top