|Combining Xtext with a MySQL database [message #1750968]
||Tue, 03 January 2017 08:16
| Jahic Benjamin
Registered: October 2015
I'm currently working on a project, where I am using Xtext and a web application.
For the web application I am using a MVC structure and it is mainly based on the Spring Framework. For storing/reading data to/from the database, I am using Spring data (javax.persistence annotations). I wanted to use something similar inside the Xtext project in order to create the database model.
The problem is that I am working with a "Model-based approach" and I would like to configure the Content of the Web Application using my DSL. After I have specified my configuration using my small DSL, I would like to store some data to a MYSQL database. The database model should reflect more or less the Ecore Model. After that the web-application is updated according to the content stored inside the DSL. I do not know how to create a persistence database according to the Ecore model, so when I change my grammar, the database model should be updated too.
I was looking at the following posts :
QUESTION 1 : Since EMFStore, Teneo and CDO seems to be "pretty old" and not updated, are there any updated solutions for storing data to the database?
I was also trying to add the javax.persistence annotations like "@Entity", "@Id", "@OneToMany",... to the src-gen by using the post processor. Unfortunately, i am not able to create it?
QUESTION 2 : Is there a possibility to add these annotations to the src-gen in order to guarantee a database structure that is based on the model created with the grammar?
Since I am working with Model-Based approach, I would like to use the database model and the database services (storage, getter) of the Xtext project, inside the Webapp, without duplicating the "database model" in order to improve the maintainability.
QUESTION 3 : Do you have any suggestions, how to create the database based on the grammar and the generated ecore model ? Or any other suggestion on how to combine the web app with a Xtext project?
Thanks for any help and I wish you all a happy new year
Powered by FUDForum
. Page generated in 0.03146 seconds