Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Model Persistence with Teneo
Model Persistence with Teneo [message #525020] Mon, 05 April 2010 11:43 Go to next message
Vishal seth is currently offline Vishal sethFriend
Messages: 32
Registered: April 2010
Member
hi,

Is it possible to persist the emf model (and not model instance) using teneo? Basically want to store the model data in RDBMS as rows. The db structure would be based upon the metamodel.

Have gone through forums & found certain topics where it definitely seems possible but not getting the clearer picture out of them.

Regards
Vishal
Re: Model Persistence with Teneo [message #525042 is a reply to message #525020] Mon, 05 April 2010 09:32 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Vishal,
just to get sure, metamodel is ecore in your case right?
Jonas

Vishal wrote:
> hi,
>
> Is it possible to persist the emf model (and not model instance) using
> teneo? Basically want to store the model data in RDBMS as rows. The db
> structure would be based upon the metamodel.
>
> Have gone through forums & found certain topics where it definitely
> seems possible but not getting the clearer picture out of them.
>
> Regards
> Vishal
Re: Model Persistence with Teneo [message #525240 is a reply to message #525020] Mon, 05 April 2010 19:18 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Vishal,
Here is a longer answer, let me know if this answers your question or not ofcourse...

Yes it is theoretically possible to store models in a database (Teneo maps the model correctly), but I advice to store
models as blobs in the database or on the file system and use annotations to tell Teneo to store references to the model
in a special way:
http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Asso ciation_Mapping#Storing_references_to_Ecore_Model_Elements

The reason not to persist an ecore model in the database is that you would also need to persist the ecore (and
XMLTypePackage) themselves in the database (as there are references from your model to the ecore/xmltype model
themselves). This results in different obstacles as there can only be one instance of the ecore model itself in memory
(the one represented by the EcorePackage class) and reading another ecore model from the database does not work. In
addition some references to ecore model elements are through eannotations, which are not persisted as foreign key
references in the databases (but as strings), this results in incorrect references when loading a model from the database.

Storing an epackage as a blob prevents these issues as the resolving of references to other epackages is done when
reading/parsing the blob in ecore resource. The resolving is done against the epackage registry set in the resourceset.

Another thing to take into account: persisting models (in the database) can only work for dynamic EMF and not for models
which have generated model code. At least when using the global package registry. In the global package registry for a
generated model the EPackage is always represented by the generated EPackage class instance (of which there is only one
in-memory at all times) and not by an EPackage read from a persistent store. Also if your model has generated model code
you can use Teneo's model reference approach to store references to the model themselves while the model is represented
by the singleton generated epackage class.

Note, you can tell Teneo which package registry to use through the PackageRegistryProvider class, it is also possible to
set the EPackage registry in a ThreadLocal in that class.

I have developed some custom solutions for customers which store models themselves in the database and also
automatically create new tables/database schemas are registered in the model store. This work is however not open source.

gr. Martin

Vishal wrote:
> hi,
>
> Is it possible to persist the emf model (and not model instance) using
> teneo? Basically want to store the model data in RDBMS as rows. The db
> structure would be based upon the metamodel.
>
> Have gone through forums & found certain topics where it definitely
> seems possible but not getting the clearer picture out of them.
>
> Regards
> Vishal


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Model Persistence with Teneo [message #525368 is a reply to message #525240] Tue, 06 April 2010 11:38 Go to previous message
Vishal seth is currently offline Vishal sethFriend
Messages: 32
Registered: April 2010
Member
Hi,

Well in our case, would never require to make an ecore model from DB. Reason we need to put the model data in DB is more from PSM perspective, i.e. would not require to do a reverse eng. from DB to ecore model.
Hence was trying an out of box option if available with Teneo for model persistence.

Thanks.
Regards
Vishal
Previous Topic:teneo hibernate LazyInitializationException
Next Topic:[Announce] MoDELS 2010 Call for Papers
Goto Forum:
  


Current Time: Sat Apr 27 00:40:04 GMT 2024

Powered by FUDForum. Page generated in 0.04305 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top