|
Re: Xtext Dsl Persistency in database [message #1082362 is a reply to message #1080651] |
Thu, 08 August 2013 13:13   |
Jaime Chavarriaga Messages: 5 Registered: June 2013 |
Junior Member |
|
|
Storing Models into databases
In EMF, you can store models into databases using Texo or Teneo
- Texo, wiki.eclipse.org/Texo, use plain Java objects
- Teneo, wiki.eclipse.org/Teneo/Hibernate, use Ecore-based objects
In any case, you must include annotations in the metamodel to define the mapping between classes and attributes in the Model and the tables and columns in the databases. Once you have persisted your models, you can use SQL o JPQL to query data on your set of models.
Other option is to store models into a Model repository such as CDO o EMFStore.
- CDO, www.eclipse.org/cdo/
- EMFStore, eclipse.org/emfstore/
Using Xtext
If you are using a predefined EMF meta-model (using import in your grammar), you can set the annotations in each meta-class without any interference to Xtext (www.softwareagility.gr/index.php?q=node/26)
If you are generating the EMF metamodel based on your grammar (using generate instead of import), I think you can use a Xtext PostProcessor to add the annotations to the generated metamodels, or create an IGeneratorFragment to use in your MWE2 workflow (just like the existing EcoreGeneratorFragment)
Additionally, if you grammar is very stable, you can generate the meta-model using your grammar, then modify your metamodel and use the modified metamodel instead of generate it in the MWE2 workflow. This trick was used in the LWC11 submission of Xtext (lwc11-xtext.eclipselabs.org.codespot.com/files/LWC11-XtextSubmission-v1.2.pdf) in the Chapter 7.
|
|
|
Re: Xtext Dsl Persistency in database [message #1082895 is a reply to message #1082362] |
Fri, 09 August 2013 07:02   |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
Some additional notes:
- If you only store the EMF model in the database you will loose all
concrete syntax information (whitespaces, comments etc.)
- Database repositories usually have a different notion of object
identity than file based ones. E.g. Xtext replaces entire subtrees of
the model when you type in the editor with the reparsed elements. Object
identity is *not* preserved. The semantic model is transient artifact
derived from the authoritative text model.
Am 08.08.13 15:13, schrieb Jaime Chavarriaga:
> Storing Models into databases
>
> In EMF, you can store models into databases using Texo or Teneo
> - Texo, wiki.eclipse.org/Texo, use plain Java objects
> - Teneo, wiki.eclipse.org/Teneo/Hibernate, use Ecore-based objects
>
> In any case, you must include annotations in the metamodel to define the
> mapping between classes and attributes in the Model and the tables and
> columns in the databases. Once you have persisted your models, you can
> use SQL o JPQL to query data on your set of models.
>
> Other option is to store models into a Model repository such as CDO o
> EMFStore.
> - CDO, www.eclipse.org/cdo/
> - EMFStore, eclipse.org/emfstore/
>
> Using Xtext
>
> If you are using a predefined EMF meta-model (using import in your
> grammar), you can set the annotations in each meta-class without any
> interference to Xtext (www.softwareagility.gr/index.php?q=node/26)
>
> If you are generating the EMF metamodel based on your grammar (using
> generate instead of import), I think you can use a Xtext PostProcessor
> to add the annotations to the generated metamodels, or create an
> IGeneratorFragment to use in your MWE2 workflow (just like the existing
> EcoreGeneratorFragment)
> Additionally, if you grammar is very stable, you can generate the
> meta-model using your grammar, then modify your metamodel and use the
> modified metamodel instead of generate it in the MWE2 workflow. This
> trick was used in the LWC11 submission of Xtext
> (lwc11-xtext.eclipselabs.org.codespot.com/files/LWC11-XtextSubmission-v1.2.pdf)
> in the Chapter 7.
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02487 seconds